Snapdrive Disk Connect Using Batch Script NetApp

As we know snapdrive command line utility will provide a lot of features which snapdrive MMC may not have.  In this article will see how to connect snapshot using snapdrive disk connect command line utility. Automate complete task by writing an small batch file.

Snapdrive Disk Connect Using Batch Script

Open command prompt Or Powershell Prompt as administrator.

run power shell as administrator

run power shell as administrator

You may get an error “Loading SnapDriveRes.dll Failed

Loading SnapDriveRes dll failed

Snapdrive Disk Connect Help

HELP Syntax

sdcli disk connect [-m <MachineName>] -p {<LUNPath> | <UNCPath>} -d <MountPoint> [-s Snapshot Copy Name] {-I (<NodeMach
ineName> <InitiatorName>)...}|{ -IG (<NodeMachineName> <igroupName>)... } -dtype {shared | dedicated} [-description <LU
N Description>] [-ds <Datastore name>] {[-e <"ResourceGroupName">] | [-n <"ResourceGroupName"> ["ResourceGroupDesc"]] |
[-csv]} [-c <"ClusterName">] [-port <"Port Number">] [-passthrough]

Connects LUN.

-p LUN path including the storage system name or UNC path to the location of the LUN file on storage system

-d Mount point of the LUN. Optional.

-s snapshot copy name used for snapshot copy restore

-IG: List of NodeMachineName and InitiatorgroupName in pairs.
 Provide the existing Initiator groups. LUN is mapped to these Initiator groups.
 One pair required for dedicated disk.
 Two or more pairs (atleast one pair for each node in the cluster) required for shared disk
 In case of FC RDM shared disk, Provide igroup having initiators from all the nodes and specify the same Initiatorgr
oupName for all the nodes.-I: List of NodeMachineName and InitiatorName in pairs.
 One pair required for dedicated disk.
 Two or more pairs (atleast one pair for each node in the cluster) required for shared disk

-dtype Disk type, shared or dedicated; if -passthrough switch is specified, this is not used.

-description: LUN Description. Optional.

-ds: Datastore name to store the LUN mapping. Optional. Applicable only in case of guest OS on ESX server.

-e Existing resource group name

-n New resource group name and description

-csv: Add shared disk to Cluster Shared Volumes.

-c Cluster name, required only if the LUN is SCSI reserved

-port: Web service port number used to communicate with SnapDrive, defaults to 808.
Resource group information (-e or -n switches) required only if the LUN is shared between cluster nodes. If the machine
name is not specified the command is executed on a local machine.
-passthrough: hot add passthrough disk. Optional. Applicable only in case of Hyper-V virtual machine

Connect snapshot using SnapDrive

PS C:\Program Files\NetApp\SnapDrive> sdcli disk connect -p SQL_SVM:/vol/ARK_SQLSERV_DB2/.snapshot/sqlsnap__ark-sqlserv_01-2
2-2018_18.00.21/lun -d f -dtype dedicated -IG ARK-SQL2012 viaRPC.10:00:00:00:c9:98:f3:3b.ARK-SQL2012
ARK-SQL2012 : Checking input parameters
ARK-SQL2012 : Checking access control
ARK-SQL2012 : Checking policies
ARK-SQL2012 : Turning on space reservation
ARK-SQL2012 : Connecting to the LUN
ARK-SQL2012 : Mounting volume on the disk
UNC Path: None
LUN Path: SQL_SVM:/vol/sdw_cl_ARK_SQLSERV_DB2_1/lun
 Storage System: SQL_SVM
 Storage System Path: /vol/sdw_cl_ARK_SQLSERV_DB2_1/lun
 Type: lun
 Disk serial number: 805zT]H5bnCL
Backed by Snapshot Copy: /vol/ARK_SQLSERV_DB2/.snapshot/sqlsnap__ark-sqlserv_01-22-2018_18.00.21/lun
 Shared: No
 BootOrSystem Disk: No
 SCSI port: 3
 Bus: 0
 Target: 2
 LUN: 1
 Readonly: No
 Size: 512071
 Snapmirror Source: No
 Snapvault Primary: No
 Disk Partition Style: GUID Partition Table (GPT)
 Clone Split Restore status: Normal
 DiskID: 3
 Volume Name: \\?\Volume{fe12a733-e91c-4213-b253-da159c0e5fb2}\
 Mount points: F:\
 IP Addresses: 192.168.20.180
The operation completed successfully.

Now you can go to My computer and verify there is an Drive with Drive letter F:/

Disconnect SnapDrive

PS C:\Program Files\NetApp\SnapDrive> sdcli disk disconnect -d f
Initializing...ARK-SQL2012 : Checking policies
ARK-SQL2012 : Checking access control
ARK-SQL2012 : Dismounting volume on the disk
ARK-SQL2012 : Disconnecting the LUN
The operation completed successfully.

Batch file for More than One snapshot connect

In my case i have snapshot name is same for all volumes/LUN’s

snapdrive disk connect batch script

it prompt us for an input of snapshot name

That’s it about snapdrive disk connect using batch file Netapp.

Related Articles

Virsh command Line Utility

racadm Script reset Multiple Dell iDrac’s

Snap Drive Installation Step by Step Guide

For More

Thanks for your wonderful Support and Encouragement