When mounting, when should I use a loop device?

Technically a loop device is a block device that writes to a file, rather than a piece of hardware. So you always use/need to use the loop back device when mounting a file.

So much for a direct answer. Maybe this serves as an explanation:

The kernel implements several layers of abstraction so that it can treat different hardware the same way. Imagine if you had to rebuild the ext2 driver for every brand of controller there is. Nobody wants that, but we want to treat every hard disk the same way. That's why we create abstraction layers.

Block devices are such an abstraction. Block devices have certain attributes and expose certain functions that can be used by other software. It doesn't matter whether you have an ATA HDD or SCSI HDD or tape drive, you always use the exact same structs and function to interact with it. It is then the task of the kernel and more explicit of that abstraction layer, to do the right thing when the block device is accessed. The right thing in the case of the block device interface is passing on the calls and data to and from the right device driver. That device driver can be, for instance, the SCSI subsystem or the driver for the loop device.

The loop device driver transforms operations on the associated block device into filesystem operations, that's how the data/partitions end up in a file.

I am probably terribly wrong in the terminology used and the name and number of abstraction layers involved. I just wanted to sketch the basic concept so it becomes clear that the loop device is not a file doing something, but it's a something that uses files. The file doesn't do anything different than it is used to do.


If you don't have to use the loop option to mount a regular file, it is because mount is detecting this and activating it for you automatically. You used to have to specify it manually.