Monday, February 27, 2012

Create Volume Snap Shot

This article explains the different commands related to Netapp Snapshot Management. 

Creating a test volume of 10gb to perform snapshot related operations
 
abc-filer > vol create testvol aggr 10g
Creation of volume 'testvol' with size 10g on containing aggregate

abc-filer > df -h testvol
Filesystem total used avail capacity Mounted on
/vol/testvol/ 8192MB 1420KB 8190MB 0% /vol/testvol/
/vol/testvol/.snapshot 2048MB 0MB 2048MB 0% /vol/testvol/.snapshot
abc-filer >

Snapshot Create

abc-filer > snap list testvol
Volume testvol
working...

No snapshots exist.
abc-filer > snap create testvol testsnap
creating snapshot...

abc-filer > snap list testvol
Volume testvol
working...

%/used %/total date name
---------- ---------- ------------ --------
0% ( 0%) 0% ( 0%) Dec 19 01:02 testsnap
abc-filer >


Snapshot Rename


abc-filer > snap rename testvol testsnap snaptest
abc-filer > snap list testvol
Volume testvol
working...

%/used %/total date name
---------- ---------- ------------ --------
3% ( 3%) 0% ( 0%) Dec 19 01:02 snaptest
abc-filer >


Snapshot Delete


abc-filer > snap delete testvol snaptest
deleting snapshot...

abc-filer > snap list testvol
Volume testvol
working...

No snapshots exist.
abc-filer >

Snap Scheduling


Scheduling automatic snapshot to keep 2 weekly, 2 daily, 8 hourly(taken at hours 8,12,16,20) online.
abc-filer > snap sched testvol 2 2 8@8,12,16,20
abc-filer > snap sched testvol
Volume testvol: 2 2
8@8,12,16,20
abc-filer >




Snap Space Reservation

Default snapshot space reserve is 20% of the volume size
abc-filer > snap reserve testvol
Volume testvol: current snapshot reserve is 20% or 2097152 k-bytes.

abc-filer > df -h testvol
Filesystem total used avail capacity Mounted on
/vol/testvol/ 8192MB 1796KB 8190MB 0% /vol/testvol/
/vol/testvol/.snapshot 2048MB 0MB 2048MB 0% /vol/testvol/.snapshot

Changing the snapshot reserve to 5% of the volume size
abc-filer > snap reserve testvol 5
abc-filer > snap reserve testvol
Volume testvol: current snapshot reserve is 5% or 524288 k-bytes.

abc-filer > df -h testvol
Filesystem total used avail capacity Mounted on
/vol/testvol/ 9728MB 1796KB 9726MB 0% /vol/testvol/
/vol/testvol/.snapshot 512MB 0MB 512MB 0% /vol/testvol/.snapshot
abc-filer >


Snap Restore

Export and mount the testvol to put some contents in the volume.
abc-filer > exportfs -p rw=geekyfacts.com,root=geekyfacts.com /vol/testvol
Login to the server for which volume was exported(in our case geekyfacts.com)
[root@geekyfacts]# mkdir /test
[root@geekyfacts]# mount abc-filer:/vol/testvol /test
[root@geekyfacts]# df -h /test
Filesystem Size Used Avail Use% Mounted on
abc-filer:/vol/testvol
9.5G 1.8M 9.5G 1% /test

[root@geekyfacts]# cd /test
[root@geekyfacts]# touch file.before_snapshot
abc-filer > snap create testvol testsnap
creating snapshot...

abc-filer > snap list testvol
Volume testvol
working...

%/used %/total date name
---------- ---------- ------------ --------
0% ( 0%) 0% ( 0%) Dec 19 02:15 testsnap

[root@geekyfacts]# touch file.aftersnap
[root@geekyfacts]# ls -l
total 0
-rw-r--r-- 1 root root 0 Dec 19 02:16 file.aftersnap
-rw-r--r-- 1 root root 0 Dec 19 02:15 file.before_snapshot

Snapshot testsnap hold only file.before_snapshot
[root@geekyfacts]# ls .snapshot/testsnap/
file.before_snapshot




Volume restore using Snapshot
abc-filer > snap restore -t vol -s testsnap testvol
WARNING! This will revert the volume to a previous snapshot.
All modifications to the volume after the snapshot will be
irrevocably lost.

Volume testvol will be made restricted briefly before coming back online.
Are you sure you want to do this? yes
You have selected volume testvol, snapshot testsnap
Proceed with revert? yes
Volume testvol: revert successful.

[root@geekyfacts]# ls
file.before_snapshot

File Restore using Snapshot
[root@geekyfacts]# rm file.before_snapshot
rm: remove regular empty file `file.before_snapshot'? y

abc-filer> snap restore -t file -s testsnap -r /vol/testvol/file.before_snapshot /vol/testvol/file.before_snapshot
WARNING! This will restore a file from a snapshot into the active
filesystem. If the file already exists in the active filesystem,
it will be overwritten with the contents from the snapshot.

Are you sure you want to do this? yes
You have selected file /vol/testvol/file.before_snapshot, snapshot testsnap
It will be restored as /vol/testvol/file.before_snapshot

Proceed with restore? yes
[root@geekyfacts]# ls
file.before_snapshot
abc-filer >#


Snap Delta

[root@geekyfacts]# touch file{1,2,3,4}
abc-filer > snap create testvol testsnap1
creating snapshot...

abc-filer > snap list testvol
Volume testvol
working...

%/used %/total date name
---------- ---------- ------------ --------
0% ( 0%) 0% ( 0%) Dec 19 02:23 testsnap1
19% (19%) 0% ( 0%) Dec 19 02:15 testsnap

abc-filer > snap delta testvol
Volume testvol
working...

From Snapshot To KB changed Time Rate (KB/hour)
--------------- -------------------- ----------- ------------ ---------------
testsnap1 Active File System 56 20s 10080.000
testsnap testsnap1 424 0d 00:08 3173.388

Summary...
From Snapshot To KB changed Time Rate (KB/hour)
--------------- -------------------- ----------- ------------ ---------------
testsnap Active File System 480 0d 00:08 3449.101

abc-filer>
Snap reclaimable

abc-filer > snap reclaimable testvol testsnap
Processing (Press Ctrl-C to exit) .
snap reclaimable: Approximately 424 Kbytes would be freed.



Ontap-NetApp Quick Sheet

Netapp/Ontap  Quick Sheet

This post contains the list of commands that will be most used and will come handy when managing or monitoring or troubleshooting a Netapp filer.

  • sysconfig -a : shows hardware configuration with more verbose information
  • sysconfig -d : shows information of the disk attached to the filer
  • version : shows the netapp Ontap OS version.
  • uptime : shows the filer uptime
  • dns info : this shows the dns resolvers, the no of hits and misses and other info
  • nis info : this shows the nis domain name, yp servers etc.
  • rdfile : Like "cat" in Linux, used to read contents of text files/
  • wrfile : Creates/Overwrites a file. Similar to "cat > filename" in Linux
  • aggr status : Shows the aggregate status
  • aggr status -r : Shows the raid configuration, reconstruction information of the disks in filer
  • aggr show_space : Shows the disk usage of the aggreate, WAFL reserve, overheads etc.
  • vol status : Shows the volume information
  • vol status -s : Displays the spare disks on the filer
  • vol status -f : Displays the failed disks on the filer
  • vol status -r : Shows the raid configuration, reconstruction information of the disks
  • df -h : Displays volume disk usage
  • df -i : Shows the inode counts of all the volumes
  • df -Ah : Shows "df" information of the aggregate
  • license : Displays/add/removes license on a netapp filer
  • maxfiles : Displays and adds more inodes to a volume
  • aggr create : Creates aggregate
  • vol create <volname> <aggrname> <size> : Creates volume in an aggregate
  • vol offline <volname> : Offlines a volume
  • vol online <volname> : Onlines a volume
  • vol destroy <volname> : Destroys and removes an volume
  • vol size <volname> [+|-]<size> : Resize a volume in netapp filer
  • vol options : Displays/Changes volume options in a netapp filer
  • qtree create <qtree-path> : Creates qtree
  • qtree status : Displays the status of qtrees
  • quota on : Enables quota on a netapp filer
  • quota off : Disables quota
  • quota resize : Resizes quota
  • quota report : Reports the quota and usage
  • snap list : Displays all snapshots on a volume
  • snap create <volname> <snapname> : Create snapshot
  • snap sched <volname> <schedule> : Schedule snapshot creation
  • snap reserve <volname> <percentage> : Display/set snapshot reserve space in volume
  • /etc/exports : File that manages the NFS exports
  • rdfile /etc/exports : Read the NFS exports file
  • wrfile /etc/exports : Write to NFS exports file
  • exportfs -a : Exports all the filesystems listed in /etc/exports
  • cifs setup : Setup cifs
  • cifs shares : Create/displays cifs shares
  • cifs access : Changes access of cifs shares
  • lun create : Creates iscsi or fcp luns on a netapp filer
  • lun map : Maps lun to an igroup
  • lun show : Show all the luns on a filer
  • igroup create : Creates netapp igroup
  • lun stats : Show lun I/O statistics
  • disk show : Shows all the disk on the filer
  • disk zero spares : Zeros the spare disks
  • disk_fw_update : Upgrades the disk firmware on all disks
  • options : Display/Set options on netapp filer
  • options nfs : Display/Set NFS options
  • options timed : Display/Set NTP options on netapp.
  • options autosupport : Display/Set autosupport options
  • options cifs : Display/Set cifs options
  • options tcp : Display/Set TCP options
  • options net : Display/Set network options
  • ndmpcopy <src-path> <dst-path> : Initiates ndmpcopy
  • ndmpd status : Displays status of ndmpd
  • ndmpd killall : Terminates all the ndmpd processes.
  • ifconfig : Displays/Sets IP address on a network/vif interface
  • vif create : Creates a VIF (bonding/trunking/teaming)
  • vif status : Displays status of a vif
  • netstat : Displays network statistics
  • sysstat -us 1 : begins a 1 second sample of the filer's current utilization (crtl - c to end)
  • nfsstat : Shows nfs statistics
  • nfsstat -l : Displays nfs stats per client
  • nfs_hist : Displays nfs historgram
  • statit : beings/ends a performance workload sampling [-b starts / -e ends]
  • stats : Displays stats for every counter on netapp. Read stats man page for more info
  • ifstat : Displays Network interface stats
  • qtree stats : displays I/O stats of qtree
  • environment : display environment status on shelves and chassis of the filer
  • storage show <disk|shelf|adapter> : Shows storage component details
  • snapmirror intialize : Initialize a snapmirror relation
  • snapmirror update : Manually Update snapmirror relation
  • snapmirror resync : Resyns a broken snapmirror
  • snapmirror quiesce : Quiesces a snapmirror bond
  • snapmirror break : Breakes a snapmirror relation
  • snapmirror abort : Abort a running snapmirror
  • snapmirror status : Shows snapmirror status
  • lock status -h : Displays locks held by filer
  • sm_mon : Manage the locks
  • storage download shelf : Installs the shelf firmware
  • software get : Download the Netapp OS software
  • software install : Installs OS
  • download : Updates the installed OS
  • cf status : Displays cluster status
  • cf takeover : Takes over the cluster partner
  • cf giveback : Gives back control to the cluster partner
  • reboot : Reboots a filer