Using Loopback Devices to Access CD-ROM Images

  1. In the kernel source code, change the define for MAX_LOOP in the file drivers/block/loop.c. The value of MAX_LOOP is 8 if it is not changed. This is the maximum number of CD-ROM images that you can have mounted at one time.
  2. Make sure the CONFIG_BLK_DEV_LOOP configuration option is enabled.

    Rebuild and reinstall the kernel if you made either of these changes.

  3. Make sure the loopback devices exists. In the following commands, <i> is the unit number of the loopback device. It must be a number in the range 0 to MAX_LOOP-1. Execute the following commands for each loopback device.

    $ cd /dev

    $ mknod -m 660 /dev/loop<i> b 7 <i>

    $ chown root.disk /dev/loop<i>

    $ chmod 666 /dev/loop<i>


  5. Create the image of the CD-ROM that you want to mount. Mount the CD-ROM if necessary. Then copy the image of the CD-ROM to a file.
  6. The following commands show an example of copying a CD-ROM image to the file /mnt/images/newimage.iso.

    $ mount /dev/cdrom

    $ dd if=/dev/cdrom of=/usr/images/newimage.iso


  7. Make the mount point for the CD-ROM image.

    $ mkdir /mnt/loop


  9. Mount the image on a loopback device.

    $ mount -o loop -t iso9660 -r /usr/images/newimage.iso /mnt/loop

    $ cd newimage

    $ ls


  11. Make an entry in /etc/fstab for the image if you want to mount it automatically when the system is booted.

    /usr/images/newimage.iso /mnt/loop iso9660 ro,loop,auto 0 0