I got a new drive recently for the specific purpose of hosting my dev vm image. How can I convert my existing qcow2 file to fill the entire disk.
So far I have tried using the following command:
qemu-image -O raw dev.qcow2 /dev/nvme0n1
but unfortunately I get “no bootable image found” when trying to boot into the image on the new drive. I would also like to expand this image on the new drive to fill the entire volume but Gparted complains that this might mess up the filesystem.
I’m not too familiar with how filesystems work in linux so I’m not sure that this is the best way of going about things so I’m open to other suggestions on what the best practice is to do in this case.
You’ll probably need to update grub(or systemd) after you do the reimage. I have it on my list of homelab stuff to do the same with a VM I want to move to a different machine, but haven’t got around to it yet.
Gparted usually warns you when you resize a bootable partition, because changing the location of the first sector can make boot loaders angry. If you’re just extending a partition without moving where it starts on the disk, then you should be fine.
Sorry, like I said I haven’t actually done this part myself yet. That qemu-image command looked correct to me at first, so I was thinking you might need to update the bootloader so it has correct UUIDs or something.
I guess to provide more information, I’ve tried pointing to the root drive and the two images that the conversion creates but I get no bootable fs for each one.
Ok I fixed it. It turns out when I was inspecting the drive through Gparted and it was asking me to fix the partition, if you hit ignore and boot directly to it using libvirt, it’s fine. Now I’m going to try and expand the partition.