HOST # wget https://cloud-images.ubuntu.com/bionic/20220518/bionic-server-cloudimg-amd64.img
HOST # cp bionic-server-cloudimg-amd64.img guest.qcow2
HOST # qemu-img resize guest.qcow2 100G

GUEST # lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda     252:0    0  100G  0 disk
├─vda1  252:1    0  2.1G  0 part /
├─vda14 252:14   0    4M  0 part
└─vda15 252:15   0  106M  0 part /boot/efi

GUEST # growpart /dev/vda 1
CHANGED: partition=1 start=227328 old: size=4384735 end=4612063 new: size=209487839,end=209715167

GUEST # resize2fs /dev/vda1

GUEST # lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda     252:0    0  100G  0 disk
├─vda1  252:1    0 99.9G  0 part /
├─vda14 252:14   0    4M  0 part
└─vda15 252:15   0  106M  0 part /boot/efi

GUEST # df -h | grep vda
/dev/vda1        97G  9.0G   88G  10% /
/dev/vda15      105M  4.4M  100M   5% /boot/efi
  • No labels