Increasing loop devices on Xen host

Trying to start another Xen guest domain, and getting an error indicating that there are no loop devices left, like the following? :


Error: Device 51714 (vbd) could not be connected. Failed to find an unused loop device

Increase the number of loop devices that the loop kernel module will create, by editing/creating /etc/modprobe.d/local-loop containing something like:


options loop max_loop=512

Reboot, and you should be all good. (I did try to create new loop devices with mknod without rebooting, but that didn’t seem to work; I think the loop kernel module would need to be unloaded and reloaded at least – that requires stopping all guest VMs anyway, so at that point I decided I may as well just reboot.

(If you don’t have loop as a kernel module, but rather compiled into the kernel, you’ll need to modify your kernel’s boot line to include max_loop=x there instead.)