[dm-crypt] How to recover partially overwritten LUKS volume?

András Korn korn.andras at gmail.com
Sat Aug 25 08:14:34 CEST 2012


I had an mdraid5 array made from four partitions of four disks, and
had LUKS on top of it.

One of the drives developed a few bad sectors (but didn't fail
completely), so I replaced it. While the array was resyncing, one of
the other drives threw a few errors, so mdadm marked it as failed and
stopped the array.

At this point, I made a mistake. I re-created the degraded array with:

mdadm --create /dev/md2 --level=5 --raid-devices=4 --assume-clean
missing /dev/sda4 /dev/sdc4 /dev/sdb4

However, I forgot to specify --metadata=0.90 (which the original array
used). I immediately rectified this, but by then mdadm had written a
raid superblock somewhere where originally there was none, and now
trying to luksOpen the volume with a known good passphrase results in
"No key available with this passphrase".

I still have the drive I removed, intact.

I have some backups but they're older than I'd like; is there anything
sensible I might to that could help me recover the LUKS volume?

My first idea is to re-create the array with the removed drive
included (making sure to specify the metadata version). This entails
uploading ~1TB over a 10MB/s link, so I thought I'd ask first whether
this had any chance of succeeding at all, or whether there was
anything else to try.



More information about the dm-crypt mailing list