/dev/vda). And don't forget to make backups before you start to "play" with your filesystem: You don't want to lose files!
Resizing storange on kvm is quite easy (It's a single command, named
img-resize). But the second part, resizing the file system on the guest is not just done with a oneliner. So I wasn't in a good mood: I never used LVM before so the first attempt was to simply open gparted - But working with LVM is really nice (although a bit different) and has several benefits!
First I created a new partition with the size of the free space on the resized HDD. This can be done with
sudo cfdisk /dev/vda
To create a new partition I did the follwoing steps:
- select the free space with the cursor
- click on "new"
- click on "write" to save changes
- quit cfdisk
Now I created a pyhsical volume with the following command:
sudo pvcreate /dev/vda3
In a next step I added the new physical volume (
/dev/vda3) to a virtual group:
sudo vgextend stats-imsm-vg /dev/vda3
Now I was able to resize the logical volume (I had several logical volumes like
root, but I wanted to resize just
sudo lvextend -l +100%FREE /dev/mapper/stats--imsm--vg-home
In the last step I had to update the filesystem, which is streight forward if you use ext3 or ext4 (like in my case). Just run
df -hT, if you don't know your filesystem.
sudo resize2fs -p /dev/mapper/stats--imsm--vg-home