Increasing the size of a filesystem where LVM is used directly on the disk:
- If you're using LVM on the storage device (not partition) directly, it's trivial to add more space.
- Increase the size of the virtual machine's storage device.
- Run `dmesg` and find the appropriate SCSI device (e.g. 2:0:0:0)
- Tell the kernel to rescan that device:
$ sudo dmesg
…
[151064.769416] sda: detected capacity change from 5368709120 to 6442450944
- Use `pvresize` to increase the size of the physical volume:
$ sudo pvresize /dev/sda
$ sudo lvextend -l+100%FREE /dev/VolGroupName/root
$ sudo resize2fs /dev/VolGroupName/root
This is only possible when the drive isn't partitioned. If the drive is partition, the easiest solution is to add a new storage device to the VM, use LVM directly on that, and add it to the existing volume group:
- Add new storage device and detect it in the guest using scsitools:
sudo apt-get install scsitools
sudo rescan-scsi-bus.sh
- Do something along the lines of:
$ sudo pvcreate /dev/sdb
$ sudo vgextend VolGroupName /dev/sdb
$ sudo lvextend -l+100%FREE /dev/VolGroupName/root
$ sudo resize2fs /dev/VolGroupName/root