What is a "loop device" when mounting?
A loop device is a pseudo ("fake") device (actually just a file) that acts as a block-based device. You want to mount a file disk1.iso
that will act as an entire filesystem, so you use loop.
The -o
is short for --options
.
And the last thing, if you want to search for "-o" you need to escape the '-'.
Try:
man mount | grep "\-o"
Traditionally, UNIX systems have had various types of nodes in their filesystems:
- directory
- file
- symlink
- block device
- character device
- FIFO
- UNIX domain socket
While there are now exceptions, generally block devices containing filesystems are mounted on directories.
Since you want to mount a file, you must first create a loop
block device that is backed by the file. This can be done using losetup
, but mount -o loop
is a shortcut that handles that behind the scenes.
Loop device is a device driver that allows you to mount a file that acts as a block device (a loop device is not actually a device type, it's an ordinary file).
For example:
mount -o loop demo.img /mnt/DEMO/
ls -l /mnt/DEMO/
You can now look at the /mnt/DEMO
subdirectory for the contents of the demo.