out of loopback devices

As a result of a power related issue our Xen server crashed. When it came back up it could not create its full complement of loop back devices.

I saw errors like:

Error: Device 770 (vbd) could not be connected. Backend device not found

dmesg, /dev, everything indicated all 32 of the loopback devices were there, but after I used 10, there were no more.

losetup saved the day. With it I was able to see that many loopback devices were in use attached to Xens that were no longer running. I don't know how this situation occurred as it has never been an issue before, but I did:

for node in `seq 0 31`
losetup /dev/loop$node

And found quite a few that could be deleted (with losetup -d /dev/loopXX ) and once I did that I was able to bring up the rest of the virtuals.

Hope this helps someone else out there.