Manage Volume Groups2023/07/18 |
This is the basic operation of managing Volume Groups.
It needs to create Physical Volume first. |
|
[1] | Create Volume Group. |
root@dlp:~#
vgcreate vg_dlp /dev/sdb1 Volume group "vg_dlp" successfully created # specify like follows if you'd like to use multiple devices root@dlp:~# vgcreate vg_dlp /dev/sdb1 /dev/sdd1 Volume group "vg_dlp" successfully created |
[2] | Display Volume Groups. |
root@dlp:~# vgdisplay vg_dlp --- Volume group --- VG Name vg_dlp System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size <160.00 GiB PE Size 4.00 MiB Total PE 40959 Alloc PE / Size 0 / 0 Free PE / Size 40959 / <160.00 GiB VG UUID rVz4AN-xbel-buqz-qsfV-Zczj-br1g-WX3Z0s |
[3] | Change Volume Group's name. |
root@dlp:~# vgrename vg_dlp vg_data Volume group "vg_dlp" successfully renamed to "vg_data"root@dlp:~# vgdisplay vg_data --- Volume group --- VG Name vg_data System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 2 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size <160.00 GiB PE Size 4.00 MiB Total PE 40959 Alloc PE / Size 0 / 0 Free PE / Size 40959 / <160.00 GiB VG UUID rVz4AN-xbel-buqz-qsfV-Zczj-br1g-WX3Z0s |
[4] | Display reports of Volume Groups. |
root@dlp:~# vgs VG #PV #LV #SN Attr VSize VFree debian-vg 1 2 0 wz--n- <79.52g 0 vg_data 1 0 0 wz--n- <160.00g <160.00g |
[5] | Scan Volume Groups. |
root@dlp:~# vgscan Found volume group "vg_data" using metadata type lvm2 Found volume group "debian-vg" using metadata type lvm2 |
[6] | Extend Volume Group. |
# add sdc1 to vg_data root@dlp:~# vgextend vg_data /dev/sdc1 Volume group "vg_data" successfully extendedroot@dlp:~# vgdisplay vg_data --- Volume group --- VG Name vg_data System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 2 Act PV 2 VG Size 319.99 GiB PE Size 4.00 MiB Total PE 81918 Alloc PE / Size 0 / 0 Free PE / Size 81918 / 319.99 GiB VG UUID rVz4AN-xbel-buqz-qsfV-Zczj-br1g-WX3Z0s |
[7] | Reduce Volume Group. |
# remove sdc1 from vg_data root@dlp:~# vgreduce vg_data /dev/sdc1 Removed "/dev/sdc1" from volume group "vg_data"root@dlp:~# vgdisplay vg_data --- Volume group --- VG Name vg_data System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size <160.00 GiB PE Size 4.00 MiB Total PE 40959 Alloc PE / Size 0 / 0 Free PE / Size 40959 / <160.00 GiB VG UUID rVz4AN-xbel-buqz-qsfV-Zczj-br1g-WX3Z0s |
[8] | Delete Volume Group. |
# disable target volume group first and delete it root@dlp:~# vgchange -a n vg_data 0 logical volume(s) in volume group "vg_data" now activeroot@dlp:~# vgremove vg_data Volume group "vg_data" successfully removed |
Sponsored Link |