Here's an Ubuntu How-to about booting from ISO-image on flash.


What I don't get is creation of loop-device in GRUB2 prior to booting a kernel:

menuentry "Ubuntu" {
    set isofile="/boot/isos/ubuntu.iso"

    loopback loop $isofile 
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash noprompt --
    initrd (loop)/casper/initrd.lz

I don't understand, what is loop-device, irrelevant of OS. I thought, loop devices are Linux entities, non-existing apart from it. Or is it a GRUB2 entity? Where can I read more about them (I failed to google anything)?

I'd understand, if they first loaded the kernel directly from flash and then created a linux loop-device out of ISO. But this way I don't get it.


That's just grub2's loop device feature. grub is able to read a number of filesystems and in addition to that to nest them, in that it is able to read files (an initrd and linux kernel above) inside a filesystem inside a file inside another file system.

It has nothing to do with linux loop devices. Grub uses it just to load those kernel and initrd files in memory. They have no life beyond that.

  • Thanks, sch. So, am I right that after executing that commands the following sequence of events happens: 1) grub extracts initrd.lz for the kernel from .iso 2) grub runs the kernel 3) after preparing stuff the kernel runs initramfs init, extracted by grub from initrd.lz to RAM 4) init of initramfs loopbacks the iso as linux loopback device 5) init process of initramfs looks for the real rootfs in casper/squashfs and chroots to it? – Boris Burkov Sep 27 '12 at 12:03
  • 1
    Yes, though I can only guess what happens at 4 and 5. 5 would more likely do a pivot_root than a chroot, as there's no point keeping the initrd FS. – Stéphane Chazelas Sep 28 '12 at 9:25
  • Oh, I meant pivoting, sorry. Got it, thanks. – Boris Burkov Sep 28 '12 at 18:31

GRUB 2 is able to mount ISOs in loopback. This is not relevant to to-be-loaded OS.

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.