9

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?

  • 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 '12 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 '12 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). – Gilles Nov 10 '12 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. – jersey bean Oct 10 '17 at 22:07
13

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy