Obtain root access with sudo -i
before running the following commands.
Online resize is not supported, it is recommended to clone the image before proceeding. To allocate additional blocks to an image that does not pre-allocate space, run the following command.
$ qemu-img resize <<image_name>> +128G
To consume the remaining space, it is recommended to create a secondary linux
filesystem based partition.
$ fdisk /dev/vda
# > p (print)
# > m (manfile)
# > n
# ... follow on screen instructions to select start and end blocks
# > t (change partition type)
# > select and set to 8e
# > w (write changes)
$ pvcreate /dev/vda4
$ pvdisplay
Volume groups are containers that can spread across partitions. To resize the primary group and consume the additional physical volume, run the command:
$ vgdisplay
$ vgextend /dev/fedora_localhost-live /dev/vda4
$ vgdisplay
# > New Size Shown
Finally, resize the logical volume with mapping of root file system to /
. Online resize will occur, it's recommended to restart your computer for ionode optimization.
$ lvresize --resizefs -l +100%FREE /dev/mapper/fedora_localhost--live-root
👋 Leave a comment if you found this gist helpful.