My desk is a mess of cables. At a glance, I have 6 power cords, 2 power strips daisy chained, 7 USB cables, 4 ethernet cables, 2 serial cables and I’m quite sure that it wouldn’t earn any upvotes on r/cableporn. This mess it not by choice, it’s just the nature of my job. Infrequently, I pull the wrong cable. Today I pulled the plug on one of my external hard-drives by obvious accident. After re-plugging it in and subsequently. After re-plugging it in and subsequently trying to access the mount point, I observed the following errors:
# cd /media/disk1 # ls ls: cannot access music: Input/output error ls: cannot access hs: Input/output error ls: cannot access goncalog: Input/output error ls: cannot access backup-laptop: Input/output error ls: cannot access conf: Input/output error
Upon close inspection, I noticed Linux had assigned a new name (now being seen as sdd instead of sdb) I also noticed the device sdb was still alive from the point of view of Linux albeit as a stale device and still enslaved by dm-0 as well given it had a volume group in it. Any form of IO to either of these devices would yield an immediate IO error for good reason. This unfortunately caused the LVM subsystem from failing to enable the volume group of which this disk was a physical volume of.
The solution turned out to be trivial (though overtime I have become more and more familiar with Linux storage related problems): un-mount the mount-point to clean any VFS layer references AND use dmsetup to remove the device mapping.
# umount /media/disk1 # dmsetup remove /dev/dm-0
Finally, re-activate the volume group and all its logical volumes and mount again
# vgchange -a y 1 logical volume(s) in volume group "vgdep" now active # mount /dev/vgdep/lvroot /media/disk1