Site icon UnixArena

VXVM Tutorial 5 – Volume resize

                    VXVM(veritas volume manager training) 5 of 10

Volume Resize:
VXVM is very flexible and reliable volume manager to resize volumes without un-mounting it. we can re-size the volumes using vxassist and resize filesystem using fsadm.vxresize command will perform both volume and filesystem re-size operation simultaneously.

Here we are going to see how to re-size the volume smvol in two different ways without un-mounting it .
# df -h /smvol
Filesystem             size   used  avail capacity  Mounted on
/dev/vx/dsk/UXDG/smvol  50M   3.1M    44M     7%    /smvol
Method :1 Increasing the volume size-Using vxassist

Step:1
Determining how much space we can increase the volume. 

# vxassist -g UXDG maxsize layout=mirror
Maximum volume size: 92160 (45Mb)

Step:2
Re-size the volume using vxassist.

# vxassist -g UXDG growby smvol 10M
or 
# vxassist -g UXDG growto smvol 60M

Step:3

Re-szie the vxfs fielsystem using fsadm. (Final size of the filesystem)
# /usr/lib/fs/vxfs/fsadm -b 60M /smvol
UX:vxfs fsadm: INFO: V-3-25942: /dev/vx/rdsk/UXDG/smvol size increased from 102400 sectors to 122880 sectors

You can see volume & filesystem increased by 10MB

# df -h /smvol
Filesystem             size   used  avail capacity  Mounted on
/dev/vx/dsk/UXDG/smvol  60M   3.1M    53M     6%    /smvol

If the volume is not increased as you will get below error.

# /usr/lib/fs/vxfs/fsadm -b 70M /smvol
UX:vxfs fsadm: ERROR: V-3-25811: cannot expand /dev/vx/rdsk/UXDG/smvol more than size of the underlying device - 122880 sectors
#
      Method:2 – Increasing the volume and filesystem using vxresize
                                        (Recommended one )
Step:1
Determining how much space we can increase the volume. 
# vxassist -g UXDG maxsize layout=mirror
Maximum volume size: 71680(35Mb)
Step:2
Resize the volume & filesystem:
You can see the changes
# /etc/vx/bin/vxresize -g UXDG  smvol +10M
# df -h /smvol
Filesystem             size   used  avail capacity  Mounted on
/dev/vx/dsk/UXDG/smvol  70M   3.1M    63M     5%    /smvol
       Method :1 Decreasing the volume size-Using vxassist
Step:1
Reduce the filesystem using fsadm. (50M is final size of the volume)
# /usr/lib/fs/vxfs/fsadm -b 50M /smvol
UX:vxfs fsadm:INFO:V-3-23586:/dev/vx/rdsk/UXDG/smvol is currently 122880 sectors - size will be reduced
# df -h /smvol/
Filesystem             size   used  avail capacity  Mounted on
/dev/vx/dsk/UXDG/smvol 50M   3.1M    44M     7%    /smvol
You can also use “-10M” in fsadm to reduce the filesystem by 10MB instead of giving  the final size (50M).
Step:2
Reduce the volume using vxassist.You will lose data if you resize the volume less than filesystem size. So better to shrink the volume with some extra space.Here instead of shrink to 50M , i am shrinking to 51MB.
# vxassist -g UXDG shrinkto smvol 51M
VxVM vxassist ERROR V-5-1-7236 Shrinking a FSGEN or RAID5 usage type volume can result in loss of data. It is recommended to use the "vxresize"command or specify "-f" option to force the operation.
Note:You will above warning messages if you used without -f option.Handle with care.
# vxassist -g UXDG -f shrinkto smvol 51M
or 
# vxassist -g UXDG -f shrinkby smvol 10M
Method:2 – Decreasing the volume and filesystem using vxresize
                                        (Recommended one )
# /etc/vx/bin/vxresize -g UXDG  smvol -10M
# df -h /smvol/
Filesystem             size   used  avail capacity  Mounted on
/dev/vx/dsk/UXDG/smvol 40M   3.1M    35M     9%    /smvol
Hope you got a better understanding on online volume resize in veritas volume manager.Please leave a comment if you have a n doubt on this. I will get back to you.
Exit mobile version