loopback device create losetup -fP myfile show all loop devices losetup -a search for a loop dev attached to a file losetup --list | grep fullpath-of-loopfile | awk '{print $1}' detach loop device losetup -d /dev/loopXX