* * * Resizing a Fedora 22 guest with `virt-resize * * * ----------------------------------------------------------- # Inside the guest [root@devstack1 ~]# df -hT Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 17M 3.9G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda3 xfs 5.0G 5.0G 80K 100% / tmpfs tmpfs 3.9G 8.0K 3.9G 1% /tmp /dev/vda1 ext4 477M 147M 301M 33% /boot tmpfs tmpfs 799M 0 799M 0% /run/user/0 ----------------------------------------------------------- # On the host [root@taroxhost vmimages]# virt-filesystems --long --all -h -a devstack1.qcow2 Name Type VFS Label MBR Size Parent /dev/sda1 filesystem ext4 - - 500M - /dev/sda2 filesystem swap - - 615M - /dev/sda3 filesystem xfs - - 69G - /dev/sda1 partition - - 83 500M /dev/sda /dev/sda2 partition - - 82 615M /dev/sda /dev/sda3 partition - - 83 69G /dev/sda /dev/sda device - - - 70G - [root@taroxhost vmimages]# ----------------------------------------------------------- [root@taroxhost vmimages]# qemu-img convert -f qcow2 -O raw devstack1.qcow2 devstack1.raw ----------------------------------------------------------- [root@taroxhost vmimages]# truncate -r devstack1.raw devstack1.raw.new [root@taroxhost vmimages]# truncate -s +40G devstack1.raw.new [root@taroxhost vmimages]# virt-filesystems --partitions --long -h -a devstack1.raw Name Type MBR Size Parent /dev/sda1 partition 83 500M /dev/sda /dev/sda2 partition 82 615M /dev/sda /dev/sda3 partition 83 69G /dev/sda ----------------------------------------------------------- [root@taroxhost vmimages]# virt-resize --expand /dev/sda3 devstack1.raw devstack1.raw.new [ 0.0] Examining devstack1.raw ********** Summary of changes: /dev/sda1: This partition will be left alone. /dev/sda2: This partition will be left alone. /dev/sda3: This partition will be resized from 68.9G to 108.9G. The filesystem xfs on /dev/sda3 will be expanded using the 'xfs_growfs' method. ********** [ 5.3] Setting up initial partition table on devstack1.raw.new [ 5.6] Copying /dev/sda1 [ 6.7] Copying /dev/sda2 [ 7.8] Copying /dev/sda3 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00 [ 167.1] Expanding /dev/sda3 using the 'xfs_growfs' method Resize operation completed with no errors. Before deleting the old disk, carefully check that the resized disk boots and works correctly. [root@taroxhost vmimages]# virsh edit devstack1 Domain devstack1 XML configuration edited. ----------------------------------------------------------- [root@taroxhost vmimages]# ls -lash devstack1* 5.1G -rw-r--r--. 1 root root 71G Sep 27 13:06 devstack1.qcow2 4.9G -rw-r--r--. 1 qemu qemu 70G Sep 27 13:03 devstack1.raw 4.9G -rw-r--r--. 1 qemu qemu 110G Sep 27 13:17 devstack1.raw.new ----------------------------------------------------------- # After booting into devstack1.raw.new: [root@devstack1 ~]# df -hT Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 432K 3.9G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda3 xfs 109G 5.0G 104G 5% / tmpfs tmpfs 3.9G 8.0K 3.9G 1% /tmp /dev/vda1 ext4 477M 147M 301M 33% /boot tmpfs tmpfs 799M 0 799M 0% /run/user/0 -----------------------------------------------------------