Skip to contentSkip to conversation

What happen if hard drive has a read error?

dm-crypt octane indice 3 participants 3 messages Oct 7, 2010

lore
Share & tools
lore
#0 lore raw

Hello

It's just a theorical question. I encrypted some data with dm-crypt on an hard drive.
But what happens if the hard drive has an error? Not a kind of a big error which cause the hard drive hangs, but just a small error that make the system doesn't read the bytes all right?

Obviously, dm-crypt won't decrypt the data. But what happens next?

-dm-crypt will panic() the kernel

-Only a block won't be decrypted, so it means that at best, only a file is corrupted, and at worst all of the filesystem is trashed, depending the location of the error?

-Or everything beyond the point of the read error will be trash?

-Or it depends of the crypto layer choosen as CBC, or else?

That's just a theorical question, thank you

Envoyé avec Inmano, ma messagerie renversante et gratuite : http://www.inmano.com

#1 lore raw
Quoted 7 lines · octane indice

It's just a theorical question. I encrypted some data with dm-crypt on an hard drive.
But what happens if the hard drive has an error? Not a kind of a big error which cause the hard drive hangs, but just a small error that make the system doesn't read the bytes all right?

Obviously, dm-crypt won't decrypt the data. But what happens next?

Basically the same like if you have IO error on plain disk - the IO operation returns IO error. Upper layer decides what to do next.

If it is in LUKS keyslot or header, you will not be able to access data at all.

If it is somewhere on data area, you lost just these bad sectors. Every sector is encrypted separately (e.g. using cbc with per-sector IV).

But note that errors on encrypted disks (in general) causes more visible problems.

Quoted 1 line

-dm-crypt will panic() the kernel

Nope. But underlying hw driver can lockup the system - but not dmcrypt itself.

Quoted 3 lines

-Only a block won't be decrypted, so it means that at best, only a file is corrupted, and at worst all of the filesystem is trashed, depending the location of the error?

yes

Review

Quoted 2 lines
(quoted diff) +0 -2
-Or everything beyond the point of the read error will be trash?
-Or it depends of the crypto layer choosen as CBC, or else?

no, see above. CBC is used inside 512 byte sector
(e.g. CBC block size is 16 bytes), sectors are encrypted independently, with different IV.

Quoted 1 line

That's just a theorical question, thank you

No, it is not theoretical question:-) HW fails are still quite common... Even with modern SSD drives.

Milan

#2 lore raw
Quoted 11 lines · Milan Broz
Quoted 7 lines · octane indice

It's just a theorical question. I encrypted some data with dm-crypt on an hard drive.
But what happens if the hard drive has an error? Not a kind of a big error which cause the hard drive hangs, but just a small error that make the system doesn't read the bytes all right?

Obviously, dm-crypt won't decrypt the data. But what happens next?

Basically the same like if you have IO error on plain disk - the IO operation returns IO error. Upper layer decides what to do next.

Just to clarify this a bit further: disk error correction capability is limited, an unrecoverable read error is a real possibility. The datasheets say once every 10^15 bits read, which whould translate to an unreadable sector once every 125 TB read. I think this is realistic, but still a bit of a worst case scenario. Also keep in mind that this is for a healthy disk only.

The error detection capabilities of the coding uses is far, far larger. An undetected unrecovrable error (i.e. you get wrong data but no error even on retry) is something unlikely enough that you can safely ignore the possibility. There are special safeguards against this, as error correction by itself can correct to the wrong value.

Nonetheless, you can find wrong data on disks without any explanation or detected errors. The reason is typically corruption in RAM or in busses before the data is written. For a complex data aquisition system (compression -> network -> disk-buffer -> tape-library), I have observed something like one unexplained bit error every 5-10TB written. This number may vary wildly in practice. Especially overclocking and cheap non-ECC RAM may drive it up.

Arno

Signature · 7 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] 
GnuPG:  ID: 1E25338F  FP: 0C30 5782 9D93 F785 E79C  0296 797F 6B50 1E25 338F
----
Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier