March 22, 2013    


 

 


Loopback devices are an interesting filesystem feature that allow a lot of flexibility in dealing with various types of disk images such as ISO image files. For example, it is possible to make a DVD image of Fedora available for download through a web or FTP site, and at the same time mount the image used for downloading on another directory as if it were a filesystem. This makes the individual files in the ISO image also available for download without having to use up disk space for a directory full of the individual files.

If you look in the /dev directory, you will find a number of loopback devices. Fedora 18 has 8 loopback devices. They are named loop0 through loop7.

Mounting The Device

Mounting loopback devices is very much like mounting any other disk type device. You can also add entries to the /etc/fstab file to make the images easier to mount and to ensure that they are mounted on a reboot.

The basic syntax for mounting a loopback device is the same as for any other device type. Note that Linux is smart enough to detect that this DVD image is an ISO9660 type, so that the type argument is not normally required. You can, of course choose to use it, if you like.

The following command at the CLI will mount the Fedora 18 DVD image on the /mnt mount point. Then you can access the image as if it were any other type of filesystem.

mount -o loop=/dev/loop1 /images/Fedora/18/Fedora-18-x86_64-DVD.iso /mnt/