3. Adding Support for More Loop Devices

The Linux-Mandrake distribution I'm using (7.0), only has support for 8 loop devices compiled into the kernel. In short, you'll only be able to share 8 CD's on a network with this default value. To support more than the default, you'll need to follow this section. If you're new to Linux, you've going to learn some cool things by accomplishing this.

3.1. Tweaking the Kernel

To increase the number of loop devices supported by the kernel, you'll need to edit the /usr/src/linux/drivers/block/loop.c file.

If you find that the kernel sources are not installed on your machine, you'll need to consult your Linux Distribution's documentation on how to install them (the Kernel Sources come with all distributions - it's part of the GPL licensing).

Change the number in the following line to however many loop devices you'll need.

#define MAX_LOOP 16

Compile the new kernel or module as the case may be. If you need some help getting started with this, read /usr/src/linux/README.

3.2. Creating the Loop Devices in /dev

The mknod command creates the devices in /dev. The loop devices have a major number of "7", and the minor numbers begin at "0". If your MAX_LOOP was defined as 8 in /usr/src/linux/drivers/block/loop.c, you should have loop0 thru loop7 in /dev. To create the /dev/loop8 device, use the following command (subsitute the appropriate number for the "8" in the example below).

mknod -m660 /dev/loop8 b 7 8

Check Owner/Group & Permissions on the new file. You can change the owner and group with the following command:

chown root.disk /dev/loop8

You can change the permissions using the following command:

chmod 666 /dev/loop8