first Shut down the virtual machine
virsh shudown image.qcow2
then Resize the image with
qemu-img resize image.qcow2 +SIZE
then Start the virtaul machine
virsh start image.qcow2
open vm console and log in
virsh console image.qcow2
Collect some details again about our current partitioning
df -h
fdisk -l
Unmont the part
umount /dev/sda1
fdisk /dev/sda
fsck -n /dev/vda2
Type m to get a list of all commands:
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
print the partition table
p
Now we delete partition
d
follow by part number
Next we create a new one
n
It was a primary partition before, so we choose p
, and again it is our partition.
If the original part had the bootable flag, so we must add it to our new
a
Now let's write our new partition table and exit fdisk
w
and reboot
then
e2fsck -f /dev/vda2
resize2fs /dev/vda2
fsck -n /dev/vda2
tune2fs -j /dev/vda2
reboot
and voila
df -h
fdisk -l
fdisk -s /dev/vda1