Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 5 down vote accepted

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.

I 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.

share|improve this answer
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? – Bob Sep 27 '12 at 12:03
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. – Bob Sep 28 '12 at 18:31

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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