If the vg are emtpy
$ sudo vgs VG #PV #LV #SN Attr VSize VFree rootvg 1 12 0 wz--n- 19.79g 7.10g
and you need space in the VG (in this example, the rootvg).
Add new Hard driver:
Adding new DISK!!! (expansion of existing disks is supported but very complicated under Linux) |
When the Hard disk is you can check the hard disks:
$ cat /proc/partitions major minor #blocks name 8 0 20971520 sda 8 1 208844 sda1 8 2 20755980 sda2 253 255 524288 dm-255 … |
after rescan the SATA bus as root (sudo su -):
echo “- – -” > /sys/class/scsi_host/host0/scan |
you can check the Harddisks again:
$ cat /proc/partitions major minor #blocks name 8 0 20971520 sda 8 1 208844 sda1 8 2 20755980 sda2 253 255 524288 dm-255 … 8 16 2097152 sdb |
you see know the new harddisk called “sdb”.
Know you can resize the rootvg:
at first we must create a physical volume from /dev/sdb
$ sudo pvcreate /dev/sdb Physical volume “/dev/sdb” successfully created |
$ sudo pvs PV VG Fmt Attr PSize PFree /dev/sda2 rootvg lvm2 a- 19.79g 7.10g /dev/sdb lvm2 a- 2.00g 2.00g |
if it gives an error like this:
$ sudo vgextend rootvg /dev/sdb No space for ‘/dev/sdb’ – volume group ‘rootvg’ holds max 1 physical volume(s). Unable to add physical volume ‘/dev/sdb’ to volume group ‘rootvg’. |
you can fix it with this command:
$ sudo vgchange rootvg -p 0 Volume group “rootvg” successfully changed |
-p, –maxphysicalvolumes MaxPhysicalVolumes Changes the maximum number of physical volumes that can belong to this volume group. For volume groups with metadata in lvm1 format, the limit is 255. If the metadata uses lvm2 format, the value 0 removes this restriction: there is then no limit. If you have a large number of physical volumes in a volume group with metadata in lvm2 format, for tool performance reasons, you should consider some use of –pvmetadatacopies 0 as described in pvcreate(8), and/or use –vgmetadatacopies. |
$ sudo vgextend rootvg /dev/sdb Volume group “rootvg” successfully extended |
after this doing the rootvg is extend and have the new size:
$ sudo vgs VG #PV #LV #SN Attr VSize VFree rootvg 2 12 0 wz–n- 21.79g 9.09g |
Awesome, it is a life saver !!!