Introduction

This script imports existing Netapp Snapshots (hourly, nightly or weekly) into an ARX Managed Volume (for CIFS). The script reads the existing snapshots on the filer and generates an ARX command line script to incorporate the filer based snapshots into an existing ARX Managed Volume. Then clients can access snapshots via CIFS that were created before ARX was installed.

What the Script Does

The ARX Managed Snapshot feature can present snapshots, checkpoints, and volume shadow copies within an ARX Managed Volume so that users can restore previous versions of files regardless of which file system they reside on. The ARX has the unique ability to manage and present multiple physical snapshots from supported vendors such as NetApp / IBM N-Series, EMC Celerra, EMC/Data Domain, and Microsoft Windows. Just as the ARX can virtualize file systems from these devices, it has the same ability to schedule/coordinate snapshots from these devices and present a single logical snapshot to users, even across a heterogeneous environment. It is important to note the ARX is not implementing a new snapshot technology; it is using the existing snapshot technology resident in the supported vendor’s devices. The ARX is merely providing the scheduling of the storage vendors snapshots and providing a virtualization layer to stitch multiple physical snapshots together so that they appear as one logical snapshot.

When deploying an ARX in a NetApp environment the existing snapshots are not accessible through ARX Managed Volume until they are “Managed” via the snapshot manage command. This script queries the current snapshots resident on the NetApp filer and creates a CLI script so that they can be easily integrated into to ARX. CIFS clients can access their snapshots after the ARX script runs. This script is specifically designed to be run against a NetApp filer.

What is the Alternative?

While one could query the snapshots on the filer manually, and then figure out the proper syntax to manage each one individually it is very time consuming due to the high number of snapshots that are retained on the filer. This script automates the discovery of the snapshots, and provides a simple CLI script that can be pasted into the ARX CLI to perform the multiple snapshot manage operations.

How to Run the Script

To run the script a modern Windows client is required (Something newer than NT) and the built in utility cscript.exe is used to execute the script. Type cscript at a command prompt on the Windows machine to see if it is installed:

U:\>cscript
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
	
Usage: CScript scriptname.extension [option...] [arguments...]

Options:
 //B         Batch mode: Suppresses script errors and prompts from displaying
 //D         Enable Active Debugging
 //E:engine  Use engine for executing script
 //H:CScript Changes the default script host to CScript.exe
 //H:WScript Changes the default script host to WScript.exe (default)
 //I         Interactive mode (default, opposite of //B)
 //Job:xxxx  Execute a WSF job
 //Logo      Display logo (default)
 //Nologo    Prevent logo display: No banner will be shown at execution time
 //S         Save current command line options for this user
 //T:nn      Time out in seconds:  Maximum time a script is permitted to run
 //X         Execute script in debugger
 //U         Use Unicode for redirected I/O from the console

Also the Putty command-line tool plink.exe is required for executing single-line SSH commands to the filer from the Windows client. You can download the plink.exe executable from: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Lastly the VBS script ntapSnaptoARX.vbs from F5 is required as it contains the commands to query the NetApp filer. The script also creates the ARX schedules to match how they are configured on NetApp.

Command Line Help

The script takes a number of command line parameters, some of which can be omitted if the defaults are acceptable. The output may then be manually edited to match namespace, volume, and rule names. The user, host and volume are the most important options; you must specify them in order to successfully run the script (as it must know where the host is and what the login name would be). If you do not specify a password on the command line it prompts you (and asterisk out the text) for security reasons. Below are the options for the script.

Basic options:

usage: cscript ntapsnaptoarx.vbs -user  -host  -volume  [-namespace  -volpath  -share  -style < rsh | ssh  > -password  ]

OPTIONS:
    user:          The username used to remotely login to the host (example: root)
    host:          The hostname/ip-address of the storage device (example: 192.168.1.100)
    password:      (optional) Login password, if not specified, it will prompt for password
    volume:        The netapp volume
    namespace:     The ARX namespace (default: ns01)
    volpath:       The ARX volume (default: vol01)
    share:         The ARX share (default: share01)
    style:         (optional) Login method SSH or Telnet (default: RSH)

Note: For the NetApp Volume parameter don’t enter the full path such as /vol/vol1, enter only the volume name i.e. vol1 and do not include any slashes.When using SSH to connect for the first time, the script may fail and you may need to first connect to the device using plink in order to cache the SSH keys:

C:\Users\jmccarron\Documents\NetApp Snap Script>cscript ntapSnaptoARX.vbs -user
root -password acopia -host 10.90.60.36 -volume vol1 -style ssh
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

ERROR: SSH key not cached/saved to registry!
Please establish a connection with plink/putty first
and save the key to the registry
Example: plink -pw  root@10.90.60.36

Here is an example connecting with plink to cache the SSH keys:

C:\Users\jmccarron\Documents\NetApp Snap Script>plink -pw acopia root@10.90.60.36
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 768 38:4e:8f:2a:31:df:14:f2:02:3f:d8:0b:b2:af:89:f1
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n) y
Using username "root".

jimmc-ntap-sim2> 

Now you can run the VBS script:

C:\Users\jmccarron\Documents\NetApp Snap Script>cscript ntapSnaptoARX.vbs -user
root -password acopia -host 10.90.60.36 -volume vol1 -style ssh
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

INFORMATION: SSH key found:0x23,0xb258e85fdfefedd40b8f80f3e5710cb45c4ac7e20b8e63
1fa16150ed5224f4f10c47262c6dcc2e92789ca14e0afb3326a8b78cd809f421e1d1d999956a9b5b
10c1c2455c983970b939a7fe1180e5fb57c8ad811d8dd2e3a7516f0796879c27d3
Writing snaplist to file \10.90.60.36-vol1.log\...
Scanning snapshots... 9/23/2011 4:31:22 PM
Converting snaplist to commandfile \10.90.60.36-vol1.cli\...
Schedule for nightly snapshots
Schedule for weekly snapshots
Schedule for hourly snapshots 00:00,08:00,12:00,16:00,20:00,21:00,
Snapshot: hourly.0       Time: Sep 23 12:00
Snapshot: weekly.2       Time: Sep 23 11:08
Snapshot: weekly.1       Time: Sep 23 11:08
Snapshot: weekly.0       Time: Sep 23 11:08
Snapshot: nightly.4      Time: Sep 23 10:51
Snapshot: nightly.3      Time: Sep 23 10:51
Snapshot: nightly.1      Time: Sep 23 10:51
Snapshot: nightly.2      Time: Sep 23 10:51
Snapshot: nightly.0      Time: Sep 23 10:51
Snapshot: hourly.4       Time: Sep 23 10:51
Snapshot: hourly.3       Time: Sep 23 10:51
Snapshot: hourly.2       Time: Sep 23 10:51
Snapshot: hourly.1       Time: Sep 23 10:51
Done.

Reviewing the Snapshot Data Collected

The script saves the output into a .log file with the filer name/volume as seen below:

C:\Users\jmccarron\Documents\NetApp Snap Script>more 10.90.60.36-vol1.log
BRAND: NETAPP
VERSION
NetApp Release 7.3.2: Thu Oct 15 03:13:41 PDT 2009

END_VERSION
START_SNAPSHOT_SCHEDULE
Volume vol1: 0 2 6@8,12,16,20

END_SNAPSHOT_SCHEDULE
TIME: 9/23/2011 12:9:36
SNAPS VOLUME:vol1
Volume vol1
working...

  %/used       %/total  date          name
----------  ----------  ------------  --------
 25% (25%)    0% ( 0%)  Sep 23 11:08  weekly.2
 40% (26%)    0% ( 0%)  Sep 23 11:08  weekly.1
 51% (26%)    0% ( 0%)  Sep 23 11:08  weekly.0
 58% (26%)    0% ( 0%)  Sep 23 10:51  nightly.4
 63% (26%)    0% ( 0%)  Sep 23 10:51  nightly.3
 67% (26%)    0% ( 0%)  Sep 23 10:51  nightly.1
 71% (26%)    0% ( 0%)  Sep 23 10:51  nightly.2
 74% (26%)    0% ( 0%)  Sep 23 10:51  nightly.0
 76% (26%)    0% ( 0%)  Sep 23 10:51  hourly.3
 78% (26%)    0% ( 0%)  Sep 23 10:51  hourly.2
 79% (26%)    0% ( 0%)  Sep 23 10:51  hourly.1
 80% (23%)    0% ( 0%)  Sep 23 10:51  hourly.0
END_SNAPS

ARX CLI Output Script

From the collected snapshot configuration the script creates a .cli file which contains the ARX CLI commands to manage the snapshots for this particular NetApp volume:

C:\Users\jmccarron\Documents\NetApp Snap Script>more 10.90.60.36-vol1.cli
no terminal confirmation
global
schedule ntapNightly
every monday tuesday wednesday thursday friday saturday
start 09/23/2011:00:00:00
exit
schedule ntapWeekly
every sunday
start 09/23/2011:00:00:00
exit
schedule ntapHourlyvol01
every hour-list 00:00,08:00,12:00,16:00,20:00,21:00,
start 09/23/2011:00:00:00
exit
namespace ns01
volume vol01
snap rule nightly
report nightly-vol01
retain 5
schedule ntapNightly
exit
snap rule weekly
report weekly-vol01
retain 3
schedule ntapWeekly
exit
snap rule hourly
report hourly-vol01
retain 4
schedule ntapHourlyvol01
exit
exit
exit
exit
snapshot manage ns01 /vol01 share01 hourly hourly.0 created-on 09/23/2011:12:00:00
snapshot manage ns01 /vol01 share01 weekly weekly.2 created-on 09/23/2011:11:08:00
snapshot manage ns01 /vol01 share01 weekly weekly.1 created-on 09/23/2011:11:08:00
snapshot manage ns01 /vol01 share01 weekly weekly.0 created-on 09/23/2011:11:08:00
snapshot manage ns01 /vol01 share01 nightly nightly.4 created-on 09/23/2011:10:51:00
snapshot manage ns01 /vol01 share01 nightly nightly.3 created-on 09/23/2011:10:51:00
snapshot manage ns01 /vol01 share01 nightly nightly.1 created-on 09/23/2011:10:51:00
snapshot manage ns01 /vol01 share01 nightly nightly.2 created-on 09/23/2011:10:51:00
snapshot manage ns01 /vol01 share01 nightly nightly.0 created-on 09/23/2011:10:51:00
snapshot manage ns01 /vol01 share01 hourly hourly.4 created-on 09/23/2011:10:51:00
snapshot manage ns01 /vol01 share01 hourly hourly.3 created-on 09/23/2011:10:51:00
snapshot manage ns01 /vol01 share01 hourly hourly.2 created-on 09/23/2011:10:51:00
snapshot manage ns01 /vol01 share01 hourly hourly.1 created-on 09/23/2011:10:51:00

Pasting the Script into the ARX

If required, edit the script so that namespace, volume, and share names match your current ARX configuration. Then login to the ARX CLI via SSH and enter enable mode. Then disable terminal confirmation, and enable terminal expert as seen below:

login as: admin
Using keyboard-interactive authentication.
Password:
Lowell01> enable
Lowell01# no terminal confirmation
Lowell01# terminal expert
Lowell01#

Now you are ready to paste the script into the ARX CLI.

Caveats and Other Tips

There are a small set of "things to know" when working with the scripts:

  • Control-C (^C) and other signals causes the script to abort without finishing the full execution of the script output. This may leave partial output or other undesirable effects that may cause the output to benusable.
  • SSH Access - There is no default implementation for SSH on Windows machines. Therefore we use plink.exe to connect and execute commands on the NetApp Filer. Plink does not block SSH connections.
  • Windows 7 Compatibility - There are two known issues with Windows 7. Windows 7 doesn’t support rsh.exe natively. And we have not found a similar tool which uses the same command line options. The use of rsh is not possible with Windows 7.
  • Password - You must use the command line option -password <password> with Windows 7. The integrated function to enter the password on the CLI after the scripts starts doesn’t work with Windows 7.

Summary

This script should help speed up the initial installation of an ARX solution into a NetApp environment with Snapshots.

Resources

ntapSnaptoARX.vbs – Hover over the code in the Codeshare and a ‘view source’ button will appear in the upper right hand corner. Copy and paste the source into Notepad and save it as ntapSnaptoARX.vbs.

Author Bio

Reinhard Frumm is a Sr. Data Solutions SE from Dusseldorf Germany and the author of the script.

Jim McCarron manages the Data Solutions Corporate Systems Engineering Group, and joined F5 through the acquisition of Acopia Networks in 2008. Jim has been working in various Sales Engineering roles with the ARX since May of 2003.