Home / Tutorials / VXVM Tutorial 8 – VXVM Instant Snapshots

VXVM Tutorial 8 – VXVM Instant Snapshots

 VXVM(veritas volume manager training) 8 of 10

A snapshot is the state of a volume at a particular point in time. Veritas Volume Manager snapshot capability for taking an image of a volume at a given point in time.It provides various snapshot depends on the environments and product cost.

There are three type of snapshot in VXVM
2.Space-optimized instant snapshot (using vxsnap)
3.Mirror Break-off snapshot  (vxassist or vxsnap)

4.Linked Break-off snapshot

Comparison of snapshot. 

table.tableizer-table { border: 1px solid #CCC; font-family: Verdana, Verdana, Geneva, sans-serif; font-size: 12px; } .tableizer-table td { padding: 4px; margin: 3px; border: 1px solid #ccc; } .tableizer-table th { background-color: #104E8B; color: #FFF; font-weight: bold; }

Snapshot feature Full-sized instant Space-optimized instant Mirror Break-off
Immediately available for use on creation Yes  Yes  No 
Requires less storage space than original volume No  Yes  No 
Can be reattached to original volume Yes  No  Yes 
Can be used to restore contents of original volume Yes  Yes  Yes 
Can quickly be refreshed without being reattached Yes  Yes  No 
Snapshot hierarchy can be split Yes  No  No 
Can be moved into separate disk group from original volume Yes  No  Yes 
Can be turned into an independent volume Yes  No  Yes 
FastResync ability persists across system reboots or cluster restarts Yes  Yes  Yes 
Synchronization can be controlled Yes  No  No 

Thanks to www.symantec.com

Full-sized instant snapshot
Full-sized instant snapshot enables you to make a full copy of an existing volume which is called snap volume.It can be mounted as separate volume and it can synchronized using refresh command.In large database environment this snapshot will very useful to take volume backup with impacting the production performance.

Here is the high level procedure:
1.Keep the all production volumes is one diskgroup 
2.Refresh the snapshot’s to make sure it’s an up-to-date.
3.Split-off the snap volumes in to new different disk group.
4.Deport the snapshot diskgroup from the production database server.
5.Import snapshot DG to the backup server. (TSM or Netbackup)
6.Start and mount the snap volumes on backup server.
7.Take backup of those snap-volumes. i.e database volume backup. 

Once the backups are complete, we need to  reverse process.
1. Un-mount the snap volumes on backup server.
2.Deport snapshot diskgroup from the backup server
3.Import snapshot diskgroup  back into the production database server
4.Join the snashot diskgroup and dataase volumes diskgroup.
5.Refresh the snapshot on the snap volumes to update the latest changes on production DB volumes.
Full-sized instant snapshot-Process 
Thanks to  www.symantec.som
Disk are used for this setup:
# vxdisk list
DEVICE TYPE DISK GROUP STATUS
disk_0 auto:cdsdisk UXDISK1 UXDG online
disk_1 auto:cdsdisk UXDISK2 UXDG online
disk_2 auto:ZFS - - ZFS
disk_3 auto:ZFS - - ZFS
disk_4 auto:cdsdisk UXDISK3 UXDG online
disk_5 auto:cdsdisk UXDISK4 UXDG online
disk_6 auto:cdsdisk UXDISK5 UXDG online
Volume is used for this setup:
v  oravol1      -        ENABLED  ACTIVE   184320   SELECT    -      fsgen
pl oravol1-01 oravol1 ENABLED ACTIVE 184320 CONCAT - RW
sd UXDISK1-01 oravol1-01 UXDISK1 0 143056 0 disk_0 ENA
sd UXDISK2-01 oravol1-01 UXDISK2 0 41264 143056 disk_1 ENA
# df -h /apporavol1/
Filesystem size used avail capacity Mounted on
/dev/vx/dsk/UXDG/oravol1 100M 43M 53M 45% /apporavol1

1.Prepare Volume for snapshot:

# vxsnap -g UXDG -b prepare oravol1
bash-3.00# vxprint -hvt
Disk group: UXDG
v oravol1 - ENABLED ACTIVE 184320 SELECT - fsgen
pl oravol1-01 oravol1 ENABLED ACTIVE 184320 CONCAT - RW
sd UXDISK1-01 oravol1-01 UXDISK1 0 143056 0 disk_0 ENA
sd UXDISK2-01 oravol1-01 UXDISK2 0 41264 143056 disk_1 ENA
dc oravol1_dco oravol1 oravol1_dcl
v oravol1_dcl - ENABLED ACTIVE 67840 SELECT - gen
pl oravol1_dcl-01 oravol1_dcl ENABLED ACTIVE 67840 CONCAT - RW
sd UXDISK2-02 oravol1_dcl-01 UXDISK2 41264 67840 0 disk_1 ENA

2.Make the Snap Volume:

# vxassist -g UXDG make oravol1-snap 100M
Note:The snap-volume should be equal to volume size.
v oravol1-snap - ENABLED ACTIVE 20480 SELECT - fsgen
pl oravol1-snap-01 oravol1-snap ENABLED ACTIVE 20480 CONCAT - RW
sd UXDISK3-01 oravol1-snap-01 UXDISK3 0 20480 0 disk_4 ENA

3.Prepare snap-volume:

You will get the below error if you didn’t prepare the snap volume.
VxVM vxassist ERROR V-5-1-7061 Volume oravol1-snap is not instant ready
# vxsnap -g UXDG -b prepare oravol1-snap
v oravol1-snap - ENABLED ACTIVE 20480 SELECT - fsgen
pl oravol1-snap-01 oravol1-snap ENABLED ACTIVE 20480 CONCAT - RW
sd UXDISK3-01 oravol1-snap-01 UXDISK3 0 20480 0 disk_4 ENA
dc oravol1-snap_dco oravol1-snap oravol1-snap_dcl
v oravol1-snap_dcl - ENABLED ACTIVE 67840 SELECT - gen
pl oravol1-snap_dcl-01 oravol1-snap_dcl ENABLED ACTIVE 67840 CONCAT - RW
sd UXDISK3-02 oravol1-snap_dcl-01 UXDISK3 20480 67840 0 disk_4 ENA
4.Link the volume to snap-volume:
# vxsnap -g UXDG -o nofreeze make source=oravol1/snapvol=oravol1-snap
# vxprint -hvt
Disk group: UXDG
v oravol1 - ENABLED ACTIVE 204800 SELECT - fsgen
pl oravol1-01 oravol1 ENABLED ACTIVE 204800 CONCAT - RW
sd UXDISK1-01 oravol1-01 UXDISK1 0 143056 0 disk_0 ENA
sd UXDISK2-01 oravol1-01 UXDISK2 0 61744 143056 disk_1 ENA
dc oravol1_dco oravol1 oravol1_dcl
v oravol1_dcl - ENABLED ACTIVE 67840 SELECT - gen
pl oravol1_dcl-01 oravol1_dcl ENABLED ACTIVE 67840 CONCAT - RW
sd UXDISK2-02 oravol1_dcl-01 UXDISK2 61744 67840 0 disk_1 ENA
sp oravol1-snap_snp oravol1 oravol1_dco

v oravol1-snap - ENABLED ACTIVE 204800 SELECT - fsgen
pl oravol1-snap-01 oravol1-snap ENABLED ACTIVE 204800 CONCAT - RW
sd UXDISK3-01 oravol1-snap-01 UXDISK3 0 20480 0 disk_4 ENA
sd UXDISK4-01 oravol1-snap-01 UXDISK4 0 143056 20480 disk_5 ENA
sd UXDISK3-03 oravol1-snap-01 UXDISK3 88320 41264 163536 disk_4 ENA
dc oravol1-snap_dco oravol1-snap oravol1-snap_dcl
v oravol1-snap_dcl - ENABLED ACTIVE 67840 SELECT - gen
pl oravol1-snap_dcl-01 oravol1-snap_dcl ENABLED ACTIVE 67840CONCAT - RW
sd UXDISK3-02 oravol1-snap_dcl-01 UXDISK3 20480 67840 0 disk_4 ENA
sp oravol1_snp oravol1-snap oravol1-snap_dco
5.To refresh snapshot:
# vxsnap -g UXDG refresh oravol1-snap source=oravol1
6.To mount the snapshot:
# df -h /snaporavol1/
Filesystem size used avail capacity Mounted on
/dev/vx/dsk/UXDG/oravol1-snap 100M 43M 53M 45% /snaporavol1
7.Testing the snapshot:
# cd /apporavol1/
bash-3.00# ls -lrt
total 81920
drwxr-xr-x 2 root root 96 Apr 1 14:04 lost+found
-rw------T 1 root root 10485760 Apr 1 14:05 test1
-rw------T 1 root root 10485760 Apr 1 14:05 run
-rw------T 1 root root 10485760 Apr 1 14:05 unixarena
-rw------T 1 root root 10485760 Apr 1 14:45 snaptest
bash-3.00# mkfile 20M snapshot-test1
bash-3.00# df -h .
Filesystem size used avail capacity Mounted on
/dev/vx/dsk/UXDG/oravol1 100M 63M 35M 65% /apporavol1
You can see still,snapshot is holding the data with last refresh state.
# df -h /snaporavol1/
Filesystem size used avail capacity Mounted on
/dev/vx/dsk/UXDG/oravol1-snap 100M 43M 53M 45% /snaporavol1

8.Trying to refresh the snapshot:
# vxsnap -g UXDG refresh oravol1-snap source=oravol1
VxVM vxsnap ERROR V-5-1-7066 Volume oravol1-snap is open, cannot refresh
# umount /snaporavol1/
# vxsnap -g UXDG refresh oravol1-snap source=oravol1
# mount -F vxfs /dev/vx/dsk/UXDG/oravol1-snap /snaporavol1/

Now you can see snapshot has been updated with last volume update.
# df -h /snaporavol1/
Filesystem size used avail capacity Mounted on
/dev/vx/dsk/UXDG/oravol1-snap 100M 63M 35M 65% /snaporavol1

# ls -lrt /snaporavol1/snapshot-test1
-rw------T 1root root 20971520 Apr1 15:09/snaporavol1/snapshot-test1
In this way you can mount the snap volume and take a backup without impact the volume performance for database filesystems if you are performing the backup on production server.

9.SPLIT snap-volume to new diskgroup:
We can spit the snapshot to new diskgroup using the below procedure.Using this method,we can import the snapshot diskgroup to backup servers for backup the volumes.
# vxdg split UXDG UXDG-SNAP oravol1-snap
VxVM vxdg ERROR V-5-1-4597 vxdg split UXDG UXDG-SNAP failed
oravol1-snap : Volume or plex device is open or attached
bash-3.00# umount /snaporavol1/
bash-3.00# vxdg split UXDG UXDG-SNAP oravol1-snap
bash-3.00# vxdg list
NAME STATE ID
UXDG enabled,cds 1364804784.18.sfos
UXDG-SNAP enabled,cds 1364810218.19.sfos

# vxprint -hvtg UXDG-SNAP
v oravol1-snap - ENABLED ACTIVE 204800 SELECT - fsgen
pl oravol1-snap-01 oravol1-snap ENABLED ACTIVE 204800 CONCAT - RW
sd UXDISK3-01 oravol1-snap-01 UXDISK3 0 20480 0 disk_4 ENA
sd UXDISK4-01 oravol1-snap-01 UXDISK4 0 143056 20480 disk_5 ENA
sd UXDISK3-03 oravol1-snap-01 UXDISK3 88320 41264 163536 disk_4 ENA
dc oravol1-snap_dco oravol1-snap oravol1-snap_dcl
v oravol1-snap_dcl - ENABLED ACTIVE 67840 SELECT - gen
pl oravol1-snap_dcl-01 oravol1-snap_dcl ENABLED ACTIVE 67840 CONCAT - RW
sd UXDISK3-02 oravol1-snap_dcl-01 UXDISK3 20480 67840 0 disk_4 ENA
sp oravol1_snp oravol1-snap oravol1-snap_dco
If the volume is in disabled state,recover using the below command
# vxrecover -s oravol1-snap
bash-3.00# mount -F vxfs /dev/vx/dsk/UXDG-SNAP/oravol1-snap /snaporavol1/
bash-3.00# df -h /snaporavol1/
Filesystem size used avail capacity Mounted on
/dev/vx/dsk/UXDG-SNAP/oravol1-snap 100M 63M 35M 65% /snaporavol1
Once you split the snapshot volume to new diskgroup,you can’t update the snapshot.
# vxsnap -g UXDG refresh oravol1-snap source=oravol1
VxVM vxsnap ERROR V-5-1-7015 Volume oravol1-snap doesn't exist

In a order to refresh the snapshot,
# vxdg join UXDG-SNAP UXDG
# vxprint -hvt
# vxsnap -g UXDG refresh oravol1-snap source=oravol1
10.To get the snapshot details:
# vxsnap -g UXDG print
NAME SNAPOBJECT TYPE PARENT SNAPSHOT %DIRTY %VALID
oravol1 -- volume -- -- -- 100.00
oravol1-snap_snp1 volume -- oravol1-snap 0.00 --
oravol1-snap oravol1_snp volume oravol1 -- 0.00 100.00
To restore data using snapshot:

Here i am deleting the /apporavol1 data

# cd /apporavol1/
# rm *
# ls -lrt
#
Trying to restore snapshot:
# vxsnap -g UXDG restore oravol1 source=oravol1-snap
VxVM vxsnap ERROR V-5-1-7067 Volume oravol1 is open, cannot restore
# umount /apporavol1/
bash-3.00# vxsnap -g UXDG restore oravol1 source=oravol1-snap

Check the restored data:
bash-3.00# mount -F vxfs /dev/vx/dsk/UXDG/oravol1 /apporavol1/
bash-3.00# cd /apporavol1/
bash-3.00# ls -lrt
total 122880
drwxr-xr-x 2 root root 96 Apr 1 14:04 lost+found
-rw------T 1 root root 10485760 Apr 1 14:05 test1
-rw------T 1 root root 10485760 Apr 1 14:05 run
-rw------T 1 root root 10485760 Apr 1 14:05 unixarena
-rw------T 1 root root 10485760 Apr 1 14:45 snaptest
-rw------T 1 root root 20971520 Apr 1 15:09 snapshot-test1
 To Delete the snapshot:
You can’t delete the snap-volume using vxassist command.
# vxassist -g UXDG remove volume oravol1-snap
VxVM vxassist ERROR V-5-1-10127 deleting volume oravol1-snap:
Record is associated

Step:1Disassociate an instant snapshot

# vxsnap -g UXDG dis oravol1-snap

Step:2 Delete the snapshot volume 
# vxedit -g UXDG -r rm oravol1-snap
VxVM vxedit ERROR V-5-1-1226 Volume oravol1-snap is not DISABLED, use -f flag
# vxedit -g UXDG -f -r rm oravol1-snap
Verify your action using vxprint
# vxprint -hvt

Thank you for reading this.Please leave a comment if you have any doubt on this.I will get back to you as soon as possible.

VMTURBO-CLOUD-CAPACITY

4 comments

  1. what is DCO??

  2. Fantastic post, really appreciate

  3. excellent one !

Leave a Reply

Your email address will not be published. Required fields are marked *