If you have install a new window 7 virtual machine to do some tests, very very quickly, you can have the same problem is had.
8 GB volume disk is not enough…
First boot of the vm, windows complains about space left, if you want to do updates, it’s too late 🙂
I used to be more virtualbox for my little needs, most for web test under several browser under native os. But, I’m not the oracle biggest fan, so go to kvm.
I use virt-manager to setup vms, and it’s very simple.
Now I want to resize my little volume, and have more space for my win7 test vm.
install libguestfs-tools
create a new volume
resize
add new volume
…
Profits !
1 – libguestfs-tools
In a terminal (konsole under kde) try virt-resize, if you don’t have it do :
virt-filesystems --long --parts --blkdevs -h -a /media/raid/vms/window7.qcow2
Name Type MBR Size Parent
/dev/sda1 partition 07 100M /dev/sda
/dev/sda2 partition 07 7,9G /dev/sda
/dev/sda device - 8,0G -
[/pastacode]
We need to resize the volume, but virt-resize copy input to output, and create a new partition with the extra space, we need to use –expand option on /dev/sda2 :
virt-resize --expand /dev/sda2 /media/raid/vms/window7.qcow2 /media/raid/vms/win7homepremium.qcow2
[ 0,0] Examining /media/raid/vms/window7.qcow2
**********
Summary of changes:
/dev/sda1: This partition will be left alone.
/dev/sda2: This partition will be resized from 7,9G to 14,9G. The
filesystem ntfs on /dev/sda2 will be expanded using the 'ntfsresize'
method.
**********
[ 4,0] Setting up initial partition table on /media/raid/vms/win7homepremium.qcow2
[ 4,0] Copying /dev/sda1
[ 4,0] Copying /dev/sda2
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[ 28,0] Expanding /dev/sda2 using the 'ntfsresize' method
Resize operation completed with no errors. Before deleting the old disk,
carefully check that the resized disk boots and works correctly.
[/pastacode]
At this point you have a new 15GB volume, check the partitions :