Extend rootvg filesystem in openstack instances running RHEL 7.1
I have created a RHEL 7.1 cloud-image with a couple of partitions and filesystems with a total size of 75GB as per my client's requirements. When this image is launched in OpenStack as an instance, with different disk sizes (for ex: 100 GB), the VG still shows up with 75GB only. While fdisk reports 100 GB, it doesn't show the additional sectors when trying to create additional partitions that can be added to the VG.
[root@test009 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg00 2 11 0 wz--n- 74.25g 13.00g
[root@test009 ~]# fdisk -l |grep "^Disk /dev/vd"
Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 sectors
[root@test009 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
auditvol vg00 -wi-ao---- 256.00m
crashvol vg00 -wi-ao---- 8.00g
homevol vg00 -wi-ao---- 5.00g
logvol vg00 -wi-ao---- 5.00g
nmonvol vg00 -wi-ao---- 6.00g
optvol vg00 -wi-ao---- 10.00g
repovol vg00 -wi-ao---- 5.00g
rootvol vg00 -wi-ao---- 10.00g
swapvol vg00 -wi-ao---- 2.00g
tmpvol vg00 -wi-ao---- 5.00g
varvol vg00 -wi-ao---- 5.00g
How can I make the OS use the additional disk space allocated to it?
Responses
I assume pvresize /dev/vdaX where X is the partition number of your physical volume would do the job. Once you see the free extents in the vg, you have to do a lvextend to extend the capacity of the desired lv and then, resize the filesystem with resize2fs.
Maybe you can use "expect" to talk to parted.
Maybe someting like this (not tested)
#!/usr/bin/expect
eval spawn parted /dev/vda
expect "Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)?"
send "F\r"
expect "Warning: Not all of the space available to /dev/vda appears to be used, you can fix the GPT to use all of the space (an extra 69206016 blocks) or continue with the
current setting?"
send "F\r"
send "print list\r"
send "quit\r"
expect eof
Hello Sagayaraj,
You should run parted against /dev/vda, not /dev/sda
so parted /dev/vda
now you should be able to create /dev/vda6
vgextend vg00 /dev/vda6
this should add the extra space to the volumegroup and you should be able to manage the extra space, add it to an existing logical volume or create new logical volumes.
Kind regards,
Jan Gerrit
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
