I use dmsetup's snapshot target to try out changes to a disk images before committing them (the primary use case is when doing data recovery - repairing the image filesystem without risking any data).

The image is loop'd read-only, (and I also loop a backing file for the snapshot backing file) and create a snapshot like so:

$ echo 0 <size> snapshot <image-loop-device> <backing-loop-device> P 1 | \
 dmsetup create <name>

It works fine: changes to <name> are saved in <backing-loop-device>, and <image-loop-device> is untouched.

However, if the <image-loop-device> is mounted, then dmsetup fails, with a Device or resource busy error. Why should dmestup should need an exclusive lock on the image device and is there a way around it (other than using a separate loop device for the mount)?

Your Answer

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

Browse other questions tagged or ask your own question.