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 .
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.
Maswood Alam says
I am big fan for Unixarena and thanks a lot for all the stuff.
I am stuck to reclaim 2 disks which are in stripe:
[root@nldtlx03 bin]# df -Ph /rpas/backup/MLP
Filesystem Size Used Avail Use% Mounted on
/dev/vx/dsk/rpas_backup_DR_dg/rpas_backup_dr_mlp_lv 1.4T 873G 505G 64% /rpas/backup/MLP
[root@nldtlx03 bin]#
In DG “rpas_backup_DR_dg” we have only one Volume which is in stripe.
1.Initially DG had 4 disks “2*240gig and 2*945gig
2. Now DG consist of 8 disks 6*240gig and 2*945gig==>4 240G disks are added to extend the FS
[root@nldtlx03 ~]# vxprint -htg rpas_backup_DR_dg
dg rpas_backup_DR_dg default default 24000 1340302435.52.nldtlx03
dm xiv_rpas_backup_DR_dg-01 xiv1_44 auto 65536 1982772896 –
dm xiv_rpas_backup_DR_dg-02 xiv1_45 auto 65536 1982772896 –
dm xiv_rpas_backup_DR_dg-03 xiv1_34 auto 65536 503957504 –
dm xiv_rpas_backup_DR_dg-04 xiv1_35 auto 65536 503957504 –
dm xiv_rpas_backup_DR_dg-05 xiv1_312 auto 65536 504060688 –
dm xiv_rpas_backup_DR_dg-06 xiv1_313 auto 65536 504060688 –
dm xiv_rpas_backup_DR_dg-07 xiv1_314 auto 65536 504060688 –
dm xiv_rpas_backup_DR_dg-08 xiv1_315 auto 65536 504060688 –
v rpas_backup_dr_mlp_lv – ENABLED ACTIVE 2956984320 SELECT rpas_backup_dr_mlp_lv-02 fsgen
pl rpas_backup_dr_mlp_lv-02 rpas_backup_dr_mlp_lv ENABLED ACTIVE 2956984320 STRIPE 4/128 RW
sd xiv_rpas_backup_DR_dg-01-01 rpas_backup_dr_mlp_lv-02 xiv_rpas_backup_DR_dg-01 0 739246080 0/0 xiv1_44 ENA
sd xiv_rpas_backup_DR_dg-02-01 rpas_backup_dr_mlp_lv-02 xiv_rpas_backup_DR_dg-02 0 739246080 1/0 xiv1_45 ENA
sd xiv_rpas_backup_DR_dg-03-01 rpas_backup_dr_mlp_lv-02 xiv_rpas_backup_DR_dg-03 0 503957504 2/0 xiv1_34 ENA
sd xiv_rpas_backup_DR_dg-05-01 rpas_backup_dr_mlp_lv-02 xiv_rpas_backup_DR_dg-05 0 235288576 2/503957504 xiv1_312 ENA
sd xiv_rpas_backup_DR_dg-04-01 rpas_backup_dr_mlp_lv-02 xiv_rpas_backup_DR_dg-04 0 503957504 3/0 xiv1_35 ENA
sd xiv_rpas_backup_DR_dg-06-01 rpas_backup_dr_mlp_lv-02 xiv_rpas_backup_DR_dg-06 0 235288576 3/503957504 xiv1_313 ENA
[root@nldtlx03 ~]#
[root@nldtlx03 ~]# vxdg -g rpas_backup_DR_dg free
DISK DEVICE TAG OFFSET LENGTH FLAGS
xiv_rpas_backup_DR_dg-01 xiv1_44 xiv1_44 739246080 1243526816 –
xiv_rpas_backup_DR_dg-02 xiv1_45 xiv1_45 739246080 1243526816 –
xiv_rpas_backup_DR_dg-05 xiv1_312 xiv1_312 235288576 268772112 –
xiv_rpas_backup_DR_dg-06 xiv1_313 xiv1_313 235288576 268772112 –
xiv_rpas_backup_DR_dg-07 xiv1_314 xiv1_314 0 504060688 –
xiv_rpas_backup_DR_dg-08 xiv1_315 xiv1_315 0 504060688 –
[root@nldtlx03 ~]#
[root@nldtlx03 ~]# vxassist -g rpas_backup_DR_dg maxsize
Maximum volume size: 4032718848 (1969101Mb)
[root@nldtlx03 ~]#
Now I have to reclaim the below 2 disks without down time:
dm xiv_rpas_backup_DR_dg-01 xiv1_44 auto 65536 1982772896 –
dm xiv_rpas_backup_DR_dg-02 xiv1_45 auto 65536 1982772896 –
Please let me know:
1. Do I need to add 240gig disks to DG? If yes how many disks will be needed?
2. Do I need to increase/decrease ncol?
3. After vxevac “what commands need to be executed to remove the disks from stripe volume and DG.
Lingeswaran R says
1. Would like to keep the FS in same size ? If yes..use then better to use # vxevac -g DG_NAME OLD_DISK NEW_DISK
2. If you want to reduce the FS size by removing these two LUNs, then use vxresize with disk that needs to be removed in the last.
Regards
Lingesh
Steve M says
Hi Lingeswaran,
very good tuto as usual … hapy new year to u !
just to share a very useful command :
vxlist vol
saravanan says
Can we increase the root file system in vxvm? if yes Please share the procedure to increase the root file system size in vxvm
Lingeswaran R says
You can’t increase the root filesystem.
Manjunath L says
Thanks for the detailed instructions… I am currently working on vxvm and these command works perfectly fine.
Manjunath L