LVM2 snapshots: device-mapper: create ioctl failed: Device or resource busy / Failed to suspend origin

If you are getting the error "device-mapper: create ioctl failed: Device or resource busy" when using the lvcreate command to set up an LVM2 snapshot, and also seeing an EBUSY on a second call to DM_DEV_CREATE ioctl when you strace the command, and finally seeing "unknown filesystem type 'DM_snapshot_cow'" when you try to mount the snapshot, then here is a clue of what may be wrong and a possible workaround:

I ran into this problem when I set up the origin device (i.e. the one of which the snapshot should be taken) manually using dmsetup (after having it manually removed - to be able to detach the loop device under it). However, as it turned out, the proper way to set up such a device is through the command vgchange -ay.

To find out whether you're having the same issue and to reach a clean initial state, first remove the offending device(s) using dmsetup (you may have to remove any partially set up logical volumes with lvremove before that). You should begin with a state in which vgdisplay -v displays your origin volume as inactive/unavailable and dmsetup ls displays no devices. After that, invoke vgchange -ay. The origin device status should now change to available and dmsetup ls should be showing the corresponding device. You can also mount it at this stage. Finally, you can (hopefully) create a snapshot without running into the above described problem.

4 comments:

Anonymous said...

But what was the underlying problem!?

Michal said...

It did help. Source of problem probably was cancelling of lvcreate in progress or failed lvremove. Tanks!

Anonymous said...

That worked, thanks. In my case, the 'dmsetup ls' showed a device that needed to be removed using 'dmsetup remove device_name'

Sys said...

> In my case, the 'dmsetup ls' showed a device
> that needed to be removed using 'dmsetup remove
> device_name'
IT WORKED here, too!

I had a problem that was not related to LVM .

Post a Comment