Using Loopback Devices to Access CD-ROM Images
- 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.
Make sure the CONFIG_BLK_DEV_LOOP configuration option is enabled.
Rebuild and reinstall the kernel if you made either of these changes.
- 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>
- 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.
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
- Make the mount point for the CD-ROM image.
$ mkdir /mnt/loop
- Mount the image on a loopback device.
$ mount -o loop -t iso9660 -r /usr/images/newimage.iso /mnt/loop
$ cd newimage
- 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
Copyright © 2003 by Bruce Blinn