Site icon UnixArena

VXVM Tutorial 9 – Space-optimized instant snapshot

 VXVM(VERITAS VOLUME MANAGER TRAINING) 9 OF 10

In this post we are going to see Space-optimized instant snapshot.Unlike other snapshots,we no need equal volume space to generate this snapshot. Using the cache objects,we can create a instant snapshot.Depends on data changes on volume,cache objects size may varied.

Ex:Volume size is increasing 100M/per hour,then you need minimum 100MB cache object.If the backJob needs two hours to complete,then you need 100×2=200MB cache volume. 

Volume used for this setup:

#vxprint -hvt
Disk group: UXDG
v oravol1 - ENABLED ACTIVE 204800 SELECT - fsgen
pl oravol1-01 oravol1 ENABLED ACTIVE 204800 CONCAT - RW
sd UXDISK6-01 oravol1-01 UXDISK6 0 204800 0 disk_7 ENA

Space-optimized instant snapshot:
Space optimized instant snapshot
Thanks www.symantec.com

1.Create a shared cache object:

# vxassist -g UXDG make cachevol 10M

Note:Since we have created the cache volume with size of 10M,if the volume changes become more than 10M,snapshot become invalid and you need to perform the snapshot again (Step:2)

#vxassist -g UXDG make cachevol 10M
#vxprint -hvt cachevol
Disk group: UXDGv cachevol - ENABLED ACTIVE 20480 SELECT - fsgen
pl cachevol-01 cachevol ENABLED ACTIVE 20480 CONCAT - RW
sd UXDISK1-01 cachevol-01 UXDISK1 0 20480 0 disk_0 ENA
#vxmake -g UXDG cache cacheobj cachevolname=cachevol autogrow=on
#vxprint -hvt cachevol
Disk group: UXDG
v cachevol cacheobj ENABLED ACTIVE 20480 SELECT - fsgen
pl cachevol-01 cachevol ENABLED ACTIVE 20480 CONCAT - RW
sd UXDISK1-01 cachevol-01 UXDISK1 0 20480 0 disk_0 ENA

# vxcache -g UXDG start cacheobj

2. Create the space-optimized instant snapshot:

#vxsnap -g UXDG make source=oravol1/newvol=snap-oravol1/cache=cacheobj
VxVM vxassist ERROR V-5-1-7061 Volume oravol1 is not instant ready
#vxsnap -g UXDG prepare oravol1
#vxsnap -g UXDG make source=oravol1/newvol=snap-oravol1/cache=cacheobj
#vxprint -hvt
Disk group: UXDG
v cachevol cacheobj ENABLED ACTIVE 20480 SELECT - fsgen
pl cachevol-01 cachevol ENABLED ACTIVE 20480 CONCAT - RW
sd UXDISK1-01 cachevol-01 UXDISK1 0 20480 0 disk_0 ENA

v oravol1 - ENABLED ACTIVE 204800 SELECT - fsgen
pl oravol1-01 oravol1 ENABLED ACTIVE 204800 CONCAT - RW
sd UXDISK6-01 oravol1-01 UXDISK6 0 204800 0 disk_7 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 UXDISK6-02 oravol1_dcl-01 UXDISK6 204800 67840 0 disk_7 ENA
sp snap-oravol1_snp oravol1 oravol1_dco

v snap-oravol1 - ENABLED ACTIVE 204800 SELECT - fsgen
pl snap-oravol1-P01 snap-oravol1 ENABLED ACTIVE 204800 CONCAT - RW
sc snap-oravol1-S01 snap-oravol1-P01 cacheobj 0 204800 0 - ENA
dc snap-oravol1_dco snap-oravol1 snap-oravol1_dcl
v snap-oravol1_dcl - ENABLED ACTIVE 67840 SELECT - gen
pl snap-oravol1_dcl-01 snap-oravol1_dcl ENABLED ACTIVE 67840 CONCAT - RW
sd UXDISK1-02 snap-oravol1_dcl-01 UXDISK1 20480 67840 0 disk_0 ENA
sp oravol1_snp snap-oravol1 snap-oravol1_dco
3.Mount the volume and you can take the backup:
# mount -F vxfs /dev/vx/dsk/UXDG/snap-oravol1 /snaporavol1/
bash-3.00# df -h /snaporavol1/
Filesystem size used avail capacity Mounted on
/dev/vx/dsk/UXDG/snap-oravol1 100M 63M 35M 65% /snaporavol1
4.To refresh the snapshot:
bash-3.00# vxsnap -g UXDG  refresh snap-oravol1 source=oravol1
VxVM vxsnap ERROR V-5-1-7066 Volume snap-oravol1 is open, cannot refresh
bash-3.00# umount /snaporavol1/
bash-3.00# vxsnap -g UXDG refresh snap-oravol1 source=oravol1
bash-3.00# mount -F vxfs /dev/vx/dsk/UXDG/snap-oravol1 /snaporavol1/
bash-3.00# df -h /snaporavol1/
Filesystem size used avail capacity Mounted on
/dev/vx/dsk/UXDG/snap-oravol1 100M 74M 24M 76% /snaporavol1
5.Detach/Attach snapshot:
Detach the snapshot from volume:
# vxsnap -g UXDG dis snap-oravol1
Attach the space optimized snapshot to volume.You can not use the reattach command for space optimized snapshot.
# vxsnap -g UXDG reattach snap-oravol1 source=oravol1
VxVM vxplex ERROR V-5-1-6390 Cannot reattach space optimized snapshot to a volume
Just refresh snapshot with source to reattach,
# vxsnap -g UXDG  refresh snap-oravol1 source=oravol1
6.Restoring a volume from a snapshot:
#  vxsnap -g UXDG restore oravol1 source=snap-oravol1
7.To delete the snapshot:
Disassociate the snapshot from volume
# vxsnap -g UXDG dis snap-oravol1
To Remove the snapshot objects,
# vxedit -g UXDG -f  -r rm snap-oravol1
# vxprint -hvt
Disk group: UXDG
v cachevol cacheobj ENABLED ACTIVE 20480 SELECT - fsgen
pl cachevol-01 cachevol ENABLED ACTIVE 20480 CONCAT - RW
sd UXDISK4-01 cachevol-01 UXDISK4 0 20480 0 disk_5 ENA

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
8.Cache volume administration:
To list the space-optimized snapshots that are created using cache objects:
# vxcache -g UXDG listvol cacheobj
snap-oravol1

To stop the cache object,

# vxcache -g UXDG stop cacheobj 
VxVM vxcache ERROR V-5-1-6418 Cannot stop cache cacheobj as it has associated subdisk(s) VxVM vxcache INFO V-5-1-9488Use vxcache [-g diskgroup] -f stop cacheobj to force stop the cache object
# vxcache -g UXDG -f stop cacheobj
9.To remove the cache object,
# vxedit -g UXDG -rf rm cacheobj
VxVM vxedit ERROR V-5-1-6321 Cache cacheobj has associated subcaches
Disassociate the snapshot from volume
# vxsnap -g UXDG dis snap-oravol1

If you get the below error ,possible cache object has been stopped,
# vxedit -g UXDG -rf rm snap-oravol1
VxVM vxedit ERROR V-5-1-10128 Cache object meta-data update error
Start the cache object again to remove the snapshot.
# vxcache -g UXDG start cacheobj

Remove the space optimized snapshot,
# vxedit -g UXDG -rf rm snap-oravol1
Now you will be able to clear the cacheobj
# vxedit -g UXDG -rf rm cacheobj
# 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
Exit mobile version