LVM unusable after uncleanly unplugging USB disk
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cryptsetup |
Confirmed
|
Undecided
|
Unassigned | ||
cryptmount (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned | ||
cryptsetup (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
lvm2 (Ubuntu) |
Triaged
|
Low
|
Unassigned |
Bug Description
Binary package hint: lvm2
When a disk containing an active LVM volume has been removed without properly closing the LVM volume first, LVM becomes unusable as the LVM mapping entries remain active but can never be closed anymore since the disk is gone.
ls -al /dev/mapper/
totaal 0
drwxr-xr-x 2 root root 180 2008-04-27 19:55 .
drwxr-xr-x 15 root root 14880 2008-04-28 12:21 ..
crw-rw---- 1 root root 10, 63 2008-04-27 21:53 control
brw-rw---- 1 root disk 254, 5 2008-04-27 19:55 encrypted-debian
brw-rw---- 1 root disk 254, 4 2008-04-27 19:55 encrypted-swap
brw-rw---- 1 root disk 254, 3 2008-04-27 19:55 luks_crypto_
luks_crypto_XXX is the partition on the USB disk. encrypted-debian and encrypted-swap are the LVM volumes which were enabled with vgchange -a y
Then, the disk was removed (perhaps laptop suspended, disk removed when packing it, laptop resumed, it's easy to accidentally unplug),
> vgchange -a n
/dev/
/dev/
/dev/
/dev/
/dev/
/dev/
So there is no real way to get rid of these anymore, and re-plugging this disk does not try to mount the Luks partition anymore. The only real way out is to reboot.
What should happen: the disk is not going to come back in the original mounted state, ever again. LVM should just forget about it, discard whatever is there, either automatically (preferred) or through a commandline switch (which would ideally be done directly by Ubuntu when one unplugs such a disk).
Changed in cryptsetup: | |
status: | New → Confirmed |
I believe this is a design defect of the upstream lvm and likely won't be resolved any time soon. As a workaround, you should be able to destroy the rogue mappings with dmsetup.