4

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.

4
  • 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. Commented Nov 4, 2018 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. Commented Nov 4, 2018 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 Commented Nov 4, 2018 at 13:02
  • Be sure that the bootloader you're using (grub?) can understand your root filesystem, or you won't boot. Commented Oct 4 at 23:11

1 Answer 1

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.

9
  • That gives me dd: error reading 'squashfs-root': Is a directory. Commented Nov 4, 2018 at 13:18
  • Oh you mean after I've re-squashed it? That works. EDIT: Although it isn't bootable in a QEMU VM. Commented Nov 4, 2018 at 13:30
  • Make sure you don’t put a forward slash after the root directory when specifying the input file. Commented Nov 4, 2018 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. Commented Nov 4, 2018 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. Commented Nov 4, 2018 at 14:04

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.