How do I setup more then 10 loopback device?

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?

Asked By: user4069

||

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).

Answered By: sparticvs

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

Answered By: Raitis Veinbahs
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.