On 10/07/2010 10:20 PM, octane indice wrote: > 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. > -dm-crypt will panic() the kernel Nope. But underlying hw driver can lockup the system - but not dmcrypt itself. > -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 > -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. > 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 _______________________________________________ dm-crypt mailing list dm-crypt@xxxxxxxx http://www.saout.de/mailman/listinfo/dm-crypt