How to convert root filesystem to virtual disk format (img, vmdk or vdi)

conversionvirtual machine

I unpacked the contents of a Mageia 6 ISO image, including a Linux root file system in it, and I've updated the root file system by chrooting into it and running dnf update. I also installed a few extra packages and I'd like to know how to turn the directory into a virtual disk format I can run in VirtualBox, or Virt Manager. If I can boot this root file system, without converting it to a virtual disk format, describing how I might manage this would also be an acceptable answer.

Best Answer

Try this:

dd if=<path of squashfs root> of=~/filesystem.img bs=1m

The should give you a raw mountable partition. If you run into errors, mounting, try without the bs argument. It will be slower, but it’s safer.

Related Question