![]() Create a new disk image with same name and with size 30GB using command: qemu-img create -f qcow2 -o preallocationmetadata centos8.qcow2 30G. Before resizing disk image, power off the Virtual machine and take the backup of the original disk image. This process will work with either a qcow2 or raw disk image. Ensure the image is not being accessed (ex: lsof) Shrink the filesystem (ex: resize2fs) Perform a filesystem check (ex: fsck) Shrink any LVM or other kind of containers (if needed) Shrink the disk image (ex: dd to a new image with skip or use qemu-img) Fsck again, test that it works Alternative: Create a new image and copy the data / MBR / etc. Also, Virt-resize should not be used on live virtual machines. Repeat steps 2,3 to allocate some more space to guest root partition if you did step 6. The partition you need to resize is the last partition on the disk.For some older Red Hat Enterprise Linux guest virtual machines, you. This may be needed to ensure the stability of the VM. If virt-resize fails, there are a number of tips that you can review and attempt in the virt-resize(1) man page. As my partition layout included a swap partition, I couldnt use the growpart command to resize it. Boot into an external live OS and resize the partition. I resized the image that uses the base image as backing file using the same command as in 1. qemu-img resize image.qcow2 +SIZE where SIZE is the size (e.g. At this point you can resize the qcow2 virtual image size to add some space and this will not affect image file size. I finally could solve it as follow: I resized the base image using qemu-img resize vmdisk.qcow 30G.Qemu-img convert -O qcow2 guest.raw guest.img Keep some free space so the system can still boot (100 MB is enough). Use gparted (gui tool) to shrink the partition from inside the guest. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |