10

From this answer the solution is to

modprobe loop max_loop=64

Which makes me allowed to use 64 loopback devices then

mknod -m 660 /dev/loop8 b 7 8

To create the devices. I did this for 8, 9, 10 and 8,9 works but 10 does not.

I then tried loopa to loopf and tried to mount a 11th device and i get the error

Error: Failed to set up a loop device:

How do I make >10 loop devices?

4
  • Make sure you are running mknod -m 660 /dev/loop10 b 7 10. It worked fine for me. What distribution are you using?
    – sparticvs
    Nov 10, 2012 at 6:11
  • @sparticvs: oops, I have been using 8 as the last value for all vars. I wonder why it let me mount my 9th and 10 device if i did it incorrectly. I use ubuntu, i'm testing right now. yep it worked. I'll accept if you answer
    – user4069
    Nov 10, 2012 at 6:23
  • You can make multiple filesystem entries for the same device. They all designate the same device. You got this error when you called losetup or mount -o loop on a loop device that's already in use (even if you reach that device through a different name). Nov 10, 2012 at 22:38
  • What I don't like about this question is that its not asking how to tell if max_loop was set to 64 properly. And nowhere am I able to find information on how to tell what max is set to. Oct 10, 2017 at 22:07

2 Answers 2

14

Make sure you are running mknod -m 660 /dev/loop10 b 7 10. The format is mknod -m 660 /dev/loop<ID> b 7 <ID> where ID is the same.

Update [07/10/2014]

I also found a good blog post to always have more at boot. See https://yeri.be/xen-failed-to-find-an-unused-loop-device

Update [05/25/2016]

I run a CentOS server, and I found that this post was also helpful when the other methods don't work.

This makes my new favorite method:

MAKEDEV /dev/loop

It creates 256 loop devices (which is the max without modifying the kernel).

0

If you want to find a free major loop device number amidst non-numbered loop device names(e.g. /dev/loop-something), you can use this command to find the biggest one and add 1:

find /dev -type b -print0 | xargs -0L1 bash -c 'stat -c "%t %T" "$1" | awk "/^7 / { print(\$2); }"' '' | sort -nru | head -n1

You must log in to answer this question.