LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Maximum mounted loop devices? (http://www.linuxquestions.org/questions/linux-general-1/maximum-mounted-loop-devices-345371/)

dplazz 07-21-2005 10:55 AM

Maximum mounted loop devices?
 
I'm building an ISO jukebox on RedHat AS4, and was curious what the maximum number of loop devices (used to mount an ISO) is for the 2.6 kernel. I know that the default setting is 256, but I'm pretty sure it can be increased. Anyone know what the actual maximum is?

jailbait 07-21-2005 11:14 AM

"I'm building an ISO jukebox on RedHat AS4, and was curious what the maximum number of loop devices (used to mount an ISO) is for the 2.6 kernel. I know that the default setting is 256, but I'm pretty sure it can be increased. Anyone know what the actual maximum is?"

The limit is the smaller of two constraints. One constraint is the maximum number set in the kernel. Increasing this number causes the kernel to use more memory so I suppose memory size is the ultimate constraint. A second constraint is the number of loopback devices available in /dev. These devices have a name of /dev/loopx where x is an integer. You can increase the number of loopback devices with the mknod command.

---------------------------
Steve Stites

dplazz 07-21-2005 11:30 AM

Thanks for the info! I figured out how to create additional loop devices in /dev now, but can the number specified in the kernel be changed without a recompile?

jailbait 07-21-2005 11:50 AM

"can the number specified in the kernel be changed without a recompile?"

I doubt it because the number is used to set aside a certain amount of memory for loop devices during a kernel compile.

------------------------------
Steve Stites

dplazz 07-21-2005 04:30 PM

It turns out the default setting isn't 256 after all. It's 8, just like in the 2.4.x kernel (I'm using 2.6.9). The silver lining is that I'm supposed to be able to pass a "max_loop=255" command through to the kernel using grub during the boot.

The problem persists though, and I still can't mount more than 8 loop devices. I even tried creating more loop devices with mknod ("mknod -m660 /dev/loop8 b 7 8"), and while they show up properly in an ls, they disappear on reboot, and still don't function while they do exist. Am I overlooking something?

jailbait 07-21-2005 05:15 PM

"The problem persists though, and I still can't mount more than 8 loop devices. I even tried creating more loop devices with mknod ("mknod -m660 /dev/loop8 b 7 8"), and while they show up properly in an ls, they disappear on reboot, and still don't function while they do exist."

Your command is correct. Why they don't function and why they disappear probably is caused by your kernel maximum loop parameter being set to 8.

"It turns out the default setting isn't 256 after all. It's 8, just like in the 2.4.x kernel (I'm using 2.6.9). The silver lining is that I'm supposed to be able to pass a "max_loop=255" command through to the kernel using grub during the boot."

The kernel parameter is set by your distribution when they compiled your kernel. They may or may not have used the default, whatever the default is.

I doubt very much that you can pass the kernel a parameter to increase the number of loop devices beyond the number that are built into the kernel's loop table or whatever. The kernel just does not have the memory available to keep track of more loop devices than were compiled in when the kernel was compiled. So loop devices in /dev beyond the kernel maximum would be inoperative. Maybe the kernel is smart enough at boot to delete excessive loop devices but I am just theorizing on that. Maybe your distribution has a boot script to delete excessive loop devices. In any case I think that you will have to both recompile the kernel and use mknod to increase the number of loop devices.

-----------------------------
Steve Stites

dplazz 07-21-2005 06:52 PM

Take a look at "/linux/drivers/block/loop.c" for a 2.6.x kernel, it actually states in the comments that you can pass that value to the kernel without altering the file itself. Anyhow, there seems to be a bit more to it than just that.


All times are GMT -5. The time now is 11:54 PM.