[dm-crypt] Restore a LUKS partition

Robert Nichols rnicholsNOSPAM at comcast.net
Thu Nov 21 17:19:58 CET 2013


On 11/21/2013 02:11 AM, Michael Grosseck wrote:
> On 21.11.2013 02:57, Arno Wagner wrote:
>> hd /dev/sda6 | head
> thanks Arno for your reply, the command above gives me this output:
>
> 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
> *
> 000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 ef |................|
> 000001c0  ff ff 83 ef ff ff 3f 00  00 00 11 31 9c 00 00 00 |......?....1....|
> 000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
> *
> 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa |..............U.|
> 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
> *
> 00007e00  4c 55 4b 53 ba be 00 01  62 6c 6f 77 66 69 73 68 |LUKS....blowfish|

For some reason /dev/sda6 starts with a partition table and looks like
a correctly partitioned whole disk. Did you perhaps use dd to copy an
image of an entire disk onto your current /dev/sda6?

Anyway, if you just want to get access to copy the data elsewhere, you
can do this (as root):

        losetup -o $((0x7e00)) -f --show /dev/sda6

That will display the name of the loop device it used, probably /dev/loop0.
You can then use cryptsetup to unlock /dev/loop0, and all your data should
be there.  You will want to run "losetup -d /dev/loop0" to release the loop
device after you've done a luksClose.

(AFAIK, cryptsetup does not support the "--offset" option for luksOpen.
  That would have been a lot simpler.)

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.



More information about the dm-crypt mailing list