You can also 'resize' the second partition, then run pvresize
on it. You would use fdisk
instead of parted
- it's uglier, but slightly lower level. Record the existing partition table, particular the start of the second partition, then delete the second partition, and recreate it with the same start point, system type (8e, Linux LVM) but the maximum end point allowed. Then you should reboot (the kernel cannot normally update partition tables for disks that are in use) and afterwards pvresize /dev/sda2
. Now your Volume Group will be bigger. This method leads to arguably neater results, but is more fraught with danger and requires a recent set of LVM tools and kernel (you neglected to mention your Linux distribution/version) ; Ignacio's method is probably safer.
No matter which method you use to put the free space into the Volume Group, you will now need to expand your Logical Volume and the filesystem therein. See lvextend
and resize2fs
.