In this post, we are going to discuss how to activate volume group in linux and how to deactivate volume group in linux. When we create a new volume group by default it gets activated during creation so we can access all the logical volumes inside the volume group and able to mount and start using in Linux.
A scenario like if this volume group is of replicated category and you have to perform DR you need to deactivate the volume group from currently active production server and need to activate the volume group once you failover to DR and ready to mount the file system on DR as part of your activity in Linux.
We are sharing here how you can deactivate the volume group and reactivate it. Your scenario may be different but commands still will be relevant.
There will be two scenarios either you want to deactivate all the LV in the system or particular as there may not be all the file systems on the server is replicated. It may have a few non replicated file systems lying on non-replicated storage.
Activate and Deactivate Volume Group LINUX
If you want to activate system-wide – all VG including all LV in the system. vgchange command in linux is the command-line tool that can be used for activating and deactivating VG in linux basically vgchange command in linux is used for changing the parameter of the volume group.
For example how to change the maximum number of the logical volume in VG.
# vgchange -l 128 /dev/loc_pcr-dg
This will change the maximum number of logical volumes in VG to 128.
Table of Contents
vgchange command in Linux
# vgchange -a y How to activate volume group in linux # vgchange -a n How to deactivate volume group in linux
Activating and Deactivating Volume Group in Linux
If you want to activate a specific volume group-wise – all VG including all LV in the system.
# vgchange -a y <vg> How to Activate Volume Group in Linux # vgchange -a n <vg> How to Deactivate Volume Group in Linux
That’s it about how to activate volume group in linux and how to deactivate volume group in linux. Please have a look at other Redhat Linux related topics of your interest.
Let me add some bonus to it.
How to check VG is active or not in Linux
# vgdisplay --- Volume group --- VG Name loc_pcr-dg System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 2 Act PV 2 VG Size 59.99 GiB PE Size 4.00 MiB Total PE 15358 Alloc PE / Size 15358 / 59.99 GiB Free PE / Size 0 / 0 VG UUID 9qU82L-Q6ZA-afvW-s8fi-zeRK-hRAp-gXJEYa
Another command-line tool is vgs command in linux is also very handy to understand the VG status. Attr here is showing wz–n- where w stands for writable and z stands for Resizable and n is allocation policy which is normal. You can refer to the vgs man page for more details on the Attribute value referred here. Oh, we were close but still, we missed it information we are looking for.
# vgs VG #PV #LV #SN Attr VSize VFree loc_pcr-dg 2 3 0 wz--n- 59.99g 0
# lvs LV VG Attr LSize pc loc_pcr-dg -wi-ao---- 1020.00m pcr loc_pcr-dg -wi-ao---- 20.00g pcr1 loc_pcr-dg -wi-ao---- 39.00g
Comments
Pingback: Important Linux Commands – RSY DIGITAL WORLD
Pingback: How to force linux server to run fsck on the next reboot – RSY DIGITAL WORLD
Pingback: RAID levels in VxVM