fsck failing to notice that the block device was pulled out from under it?

Theodore Ts'o tytso at mit.edu
Tue May 26 01:14:01 UTC 2015

On Mon, May 25, 2015 at 11:59:44PM +0200, Tomas Pospisek wrote:
> Hello,
> tl;dr: it seems like fsck fails to notice when the block device
> disappears from under it.

When a block device disappears, reads (and writes) using the file
descriptor open on the block device will return errors, and that is
how e2fsck "notices".  And as fsck is concerned, the only "block
device" which is is interacting with is the device mapper node which
is exported by the LUKS encrypted device --- and the problem is that
the device mapper node is *not* disappearing.

> Nevertheless fsck was happily continuing with its disk check.
> So I think there are a few parts broken in this chain of layers. The one
> that I can put a finger on is that fsck should notice or should be
> notified when the block device under it ceases to exist, as is the case
> when the LUKS device becomes locked again.
> I'm not sure why fsck doesn't notice. Doesn't it get the right
> information from the LUKS block device?

Apparently not.  I think you need to complain to the LUKS and
device-mapper developers.  I will note that some device-mapper nodes
are *designed* to hide the fact that one or more of the underlying
block device might have disappeared --- for example, in the case of
dm_multipath or dm_raid device, you want the exported device-mapper
"block device" to survive even if one or more of the underyling
constituent block devices have disappeared.  That's the whole point of
those device-mapper nodes.

> The end result of this is, that my backups are lost. The disk can still
> be read, but LUKS is no more able to decipher it.

So that seems weird.  I don't know why LUKS would be corrupting the
device just because of a USB disconnect.  As I said, the worst that
*should* happen is that reads and writes should be returning I/O
errors.  But this is a LUKS / dm_crypt problem, so you should be
raising this question with the device mapper folks.

Good luck,

						- Ted

More information about the Ext3-users mailing list