|
This article explains the different commands related to Netapp Snapshot Management. Creating a test volume of 10gb to perform snapshot related operations geekyfacts-filer > vol create testvol aggr 10g Creation of volume 'testvol' with size 10g on containing aggregate geekyfacts-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 geekyfacts-filer >
Snapshot Create
geekyfacts-filer > snap list testvol Volume testvol working... No snapshots exist. geekyfacts-filer > snap create testvol testsnap creating snapshot...
geekyfacts-filer > snap list testvol Volume testvol working... %/used %/total date name ---------- ---------- ------------ -------- 0% ( 0%) 0% ( 0%) Dec 19 01:02 testsnap geekyfacts-filer >
Snapshot Rename
geekyfacts-filer > snap rename testvol testsnap snaptest
geekyfacts-filer > snap list testvol Volume testvol working... %/used %/total date name ---------- ---------- ------------ -------- 3% ( 3%) 0% ( 0%) Dec 19 01:02 snaptest geekyfacts-filer >
Snapshot Delete
geekyfacts-filer > snap delete testvol snaptest deleting snapshot...
geekyfacts-filer > snap list testvol Volume testvol working... No snapshots exist. geekyfacts-filer >
Snap Scheduling
Scheduling automatic snapshot to keep 2 weekly, 2 daily, 8 hourly(taken at hours 8,12,16,20) online.
geekyfacts-filer > snap sched testvol 2 2 8@8,12,16,20 geekyfacts-filer > snap sched testvol Volume testvol: 2 2 8@8,12,16,20 geekyfacts-filer >
Snap Space Reservation
Default snapshot space reserve is 20% of the volume size geekyfacts-filer > snap reserve testvol Volume testvol: current snapshot reserve is 20% or 2097152 k-bytes. geekyfacts-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 geekyfacts-filer > snap reserve testvol 5 geekyfacts-filer > snap reserve testvol Volume testvol: current snapshot reserve is 5% or 524288 k-bytes. geekyfacts-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 geekyfacts-filer >
Snap Restore
Export and mount the testvol to put some contents in the volume. geekyfacts-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 geekyfacts-filer:/vol/testvol /test
[root@geekyfacts]# df -h /test Filesystem Size Used Avail Use% Mounted on geekyfacts-filer:/vol/testvol 9.5G 1.8M 9.5G 1% /test
[root@geekyfacts]# cd /test
[root@geekyfacts]# touch file.before_snapshot geekyfacts-filer > snap create testvol testsnap creating snapshot... geekyfacts-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 geekyfacts-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 geekyfacts-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 geekyfacts-file >#
Snap Delta
[root@geekyfacts]# touch file{1,2,3,4} geekyfacts-file > snap create testvol testsnap1 creating snapshot... geekyfacts-file > 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 geekyfacts-file > 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 geekyfacts-file>
Snap reclaimable
geekyfacts-file > snap reclaimable testvol testsnap Processing (Press Ctrl-C to exit) . snap reclaimable: Approximately 424 Kbytes would be freed.
|