EMC – Using naviseccli to create a VNX Snapshot

If you’re a VNX customer you’ve probably heard someone bang on about how easy to use VNX Snapshots are, particularly if they’ve used SnapView in the past. If you’re after the good word on VNX Snapshots, check out this whitepaper from EMC here. Tomek has a reasonable write-up here as well.

In any case I’ve been working with a customer on some migration scripts and they wanted to take VNX Snapshots as well as VM snapshots while they update their OS and apps. I wrote about creating SnapView Clones with naviseccli some time ago, but I find VNX Snapshots a shedload easier to work with. This is will, as always, be dictated by your own set of requirements, circumstances and religious beliefs.

So here’s what you need to do to get from start to finish. Note that I haven’t covered creating Snapshot Mount Points (SMPs) in this, nor do I talk about using host-based tools such as SnapCLI. I’ll follow up in the future with some words around this.

[Update] I forgot to mention @Dynamoxxx / Storage Monkey‘s excellent posts on this subject too – have a look here for Linux and here for Windows.

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Program Files (x86)\EMC\Navisphere CLI>NaviSECCli.exe
Not enough arguments
  Usage:
    [-User <username>] [-Password <password>]
    [-Scope <0 - global; 1 - local; 2 - LDAP>]
    [-Address <IPAddress | NetworkName> | -h <IPAddress | NetworkName>]
    [-Port <portnumber>] [-Timeout <timeout> | -t <timeout>]
    [-AddUserSecurity | -RemoveUserSecurity | -DeleteSecurityEntry]
    [-Parse | -p] [-NoPoll | -np] [-cmdtime]
    [-Xml] [-f <filename>] [-Help] CMD <Optional Arguments>
    [security -certificate]

You’ll need to set yourself up if you’re using a fresh installation.

C:\Program Files (x86)\EMC\Navisphere CLI>NaviSECCli.exe -addusersecurity -scope 0 -user sysadmin

You can then create a snapshot of LUN 7 called “testsnap1” which is read/write and will be kept for 4 hours.

C:\Program Files (x86)\EMC\Navisphere CLI>NaviSECCli.exe -address 192.168.0.100 snap -create -res 7 -resType LUN -name "testsnap1" -descr "snap via CLI" -keepFor 4h -allowreadwrite yes
Unable to validate the identity of the server.  There are issues with the certificate presented.
Only import this certificate if you have reason to believe it was sent by a trusted source.
Certificate details:
Subject:        CN=192.168.0.100,CN=SPA,OU=CLARiiON
Issuer: CN=192.168.0.100,CN=SPA,OU=CLARiiON
Serial#:        fcd99068
Valid From:     2015:01:15:02:55:01
Valid To:       2020:01:14:02:55:01
Would you like to [1]Accept the certificate for this session, [2] Accept and store, [3] Reject the certificate?
Please input your selection(The default selection is [1]):
2

Note that there’s no output from this command. If you want to check out the snapshots you have, you can list them.

C:\Program Files (x86)\EMC\Navisphere CLI>naviseccli -address 192.168.0.100 snap -list

Name:  testsnap1
Description:  snap via CLI
Creation time:  05/19/15 10:22:37
Source LUN(s):  7
Source CG:  N/A
State:  Ready
Allow Read/Write:  Yes
Modified:  No
Allow auto delete:  No
Expiration date:  05/19/15 14:22:37

Want to change the ID of the snapshot or change the autodelete setting?

C:\Program Files (x86)\EMC\Navisphere CLI>naviseccli -address 192.168.0.100 snap -modify -id "testsnap1" -name "testsnap2" -allowautodelete yes
Setting auto-delete on this Snapshot will clear expiration date on it. Are you sure you want to perform this operation?(y/n): n
C:\Program Files (x86)\EMC\Navisphere CLI>naviseccli -address 192.168.0.100 snap -modify -id "testsnap1" -name "testsnap2"

Great, now let’s get rid of it.

C:\Program Files (x86)\EMC\Navisphere CLI>naviseccli -address 192.168.0.100 snap -destroy -id "testsnap2"
Are you sure you want to perform this operation?(y/n): y

And that’s about it.

EMC – Creating SnapView Clones with naviseccli

EMC SnapView has been around for some time on the CLARiiON and VNX. I don’t want to go into the how and what of using SnapView in your environment, but I thought this quick rundown of creating a SnapView Clone using naviseccli might be useful. You can also do all of this using the Wizard in Unisphere – if you’re into pointy hats and capes.

You’d be best served to test these commands in your own environment before trying them on data you care about. And I take no responsibility if you pooch it because you’ve followed my guide without thinking through the ramifications of your actions. Also, be careful of the line breaks here – if you don’t get the whole line copied you’ll run into issues. So let’s get to it.

I’m assuming that you’ve never done clones before, so we’re starting from scratch. Firstly, bind two LUNs for use as Clone Private LUNs. These can be any size you want, but their usefulness is limited beyond 1GB each.

naviseccli -h 192.168.0.90 bind r5 901 -rg 1 -sp a -cap 1024 -sq mb
naviseccli -h 192.168.0.90 bind r5 902 -rg 1 -sp b -cap 1024 -sq mb

Note that I already had a RAID Group set aside for the LUNs. You then need to create a LUN to use as the clone. This LUN will evidently be the same size as the source. Note that it can reside on a different SP. Let’s assume the source LUN is 1TB.

naviseccli -h 192.168.0.90 bind r5 910 -rg 7 -sp b -cap 1024 -sq gb

Now it’s time to allocate the 1GB LUNs as CPLs.

naviseccli -h 192.168.0.90 snapview -allocatecpl -spA 901 -spB 902 -o

With SnapView, AllowProtectedRestore is disabled by default. You can change this on a global level with the following command. Note the -o prevents naviseccli from confirming my actions. If you’re unsure about the commands you want to use, you can leave -o off.

naviseccli -h 192.168.0.90 snapview -changeclonefeature -AllowProtectedRestore 0|1(Disabled|Enabled) -o

Create a Clone Group to store the Source and Clone in. At this point we nominate the LUN(s) that we want to be cloned.

naviseccli -h 192.168.0.90 snapview -createclonegroup -name VMwareMgmtSnapClone -luns 3 -description "Clone Group for vSphere Upgrade" -o

Now add the clone to the clone group.

naviseccli -h 192.168.0.90 snapview -addclone -Name VMwareMgmtSnapClone -Luns 910

The listclonegroup is used to get info on the array’s SnapView clone status.

naviseccli -h 192.168.0.90 snapview -listclonegroup
Name: VMwareMgmtSnapClone
CloneGroupUid: 50:06:01:60:C6:E0:43:CF:01:00:00:00:00:00:00:00
InSync: Yes
Description: Clone Group for vSphere Upgrade Testing
QuiesceThreshold: 60
SourceMediaFailure: No
IsControllingSP: No
SourceLUNSize: 2147483648
CloneCount: 1
Sources: 3
Clones:
CloneID: 0100000000000000
CloneState: Synchronizing
CloneCondition: Synchronizing
AvailableForIO: No
CloneMediaFailure: No
IsDirty: No
PercentSynced: 0
RecoveryPolicy: Auto
SyncRate: Medium
CloneLUNs: 910
UseProtectedRestore: No
IsFractured: No

 

Using -changeclone you can change the sync rate and protected restore options for the clone. In this example I’ve changed the rate to High (from Medium) and set it to use Protected Restore.

naviseccli -h 192.168.0.90 snapview -changeclone -name VMwareMgmtSnapClone -cloneid 0100000000000000 -SyncRate high -UseProtectedRestore 1 -o

Depending on how much data needs to be synchronized, it might take a little time before the output looks like this:

naviseccli -h 192.168.0.90 snapview -listclonegroup
Name: VMwareMgmtSnapClone
CloneGroupUid: 50:06:01:60:C6:E0:43:CF:01:00:00:00:00:00:00:00
InSync: Yes
Description: Clone Group for vSphere Upgrade Testing
QuiesceThreshold: 60
SourceMediaFailure: No
IsControllingSP: No
SourceLUNSize: 2147483648
CloneCount: 1
Sources: 3
Clones:
CloneID: 0100000000000000
CloneState: Synchronized
CloneCondition: Normal
AvailableForIO: No
CloneMediaFailure: No
IsDirty: No
PercentSynced: 100
RecoveryPolicy: Auto
SyncRate: High
CloneLUNs: 910
UseProtectedRestore: Yes
IsFractured: No

After synchronization, use the Windows-based tool admsnap to flush I/O from the LUN

admsnap flush -o E:

Wait for the clone to transition to synchronized. Once this is complete, you can fracture the Clone.

naviseccli -h 192.168.0.90 snapview -fractureclone -Name VMwareMgmtSnapClone -CloneId 0100000000000000 -o

Verify that it’s fractured and consistent

naviseccli -h 192.168.0.90 snapview -listclonegroup
Name: VMwareMgmtSnapClone
CloneGroupUid: 50:06:01:60:C6:E0:43:CF:01:00:00:00:00:00:00:00
InSync: Yes
Description: Clone Group for vSphere Upgrade Testing
QuiesceThreshold: 60
SourceMediaFailure: No
IsControllingSP: No
SourceLUNSize: 2147483648
CloneCount: 1
Sources: 3
Clones:
CloneID: 0100000000000000
CloneState: Consistent
CloneCondition: Administratively Fractured
AvailableForIO: Yes
CloneMediaFailure: No
IsDirty: No
PercentSynced: N/A
RecoveryPolicy: Auto
SyncRate: High
CloneLUNs: 910
UseProtectedRestore: Yes
IsFractured: Yes

If you wanted to use this clone to run a backup via a secondary host, you would then add it to the storage group of that host.

naviseccli -h 192.168.0.90 storagegroup -addhlu -gname SGNAME -hlu HOSTLUNID -alu ARRAYLUNID

Once you’ve added it to the storage group, you can use admsnap to scan for the clone on the secondary host

admsnap clone_activate

If for some reason you want to use the clone to restore the data on the source LUN, you’d use the Reverse Synchronize process.

naviseccli clone -reversesyncclone -name NAME -cloneid CLONEID -UseProtectedRestore 0|1 -o

If you want to keep the clone to use again in the future, fracture it from the source again.

naviseccli clone -fractureclone -name NAME -cloneid CLONEID -o

And that’s SnapView Clones with naviseccli in a nutshell.