2

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.

  • I know very little about virtual systems but I’m files are raw and uncompressed. If you could boot from a bootdisk or access the system remotely so all file systems other than the root were I mounted you could use “dd” to generate the image. – mreff555 Nov 4 '18 at 12:20
  • Must admit I don't follow what you're saying. The root file system of the Mageia system is stored on my data partition at "VirtualBox VMs"/iso/Mageia-6.1-LiveDVD-Plasma-x86_64-DVD/Mageia-distrib/squashfs-root, so it's not at the root of that file system (i.e. not at /), but it's a fully functional Linux root file system (i.e. bin/, boot/, etc/, usr/, var/, etc. directories are in it and contain the very files you'd expect in a Mageia root file system). This is why I can chroot into it and run dnf update without a problem. – BH2017 Nov 4 '18 at 12:51
  • Let me clarify. “dd” can copy entire file systems and turn them into an image. It is a very flexible and powerful command. However before you attempt this you would want to unmount any partitions with a mount point inside that partition. You will want to read the man pages but the input file would be the root of the filesystem the output file would be the image name. After reading what you said more carefully there is probably nothing to unmount. If you aren’t chrooted into the environment – mreff555 Nov 4 '18 at 13:02
0

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.

  • That gives me dd: error reading 'squashfs-root': Is a directory. – BH2017 Nov 4 '18 at 13:18
  • Oh you mean after I've re-squashed it? That works. EDIT: Although it isn't bootable in a QEMU VM. – BH2017 Nov 4 '18 at 13:30
  • Make sure you don’t put a forward slash after the root directory when specifying the input file. – mreff555 Nov 4 '18 at 13:53
  • Also qemu may want you to convert it. It complains about raw files. Qemu has the command to do it but I rarely use it and I forget how. – mreff555 Nov 4 '18 at 13:56
  • No slashes, I've tried using format=raw,file=mageia-6.img and still QEMU doesn't recognize it as a valid boot medium. – BH2017 Nov 4 '18 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.