Recovering LUKS EXT4 partition - incorrect size Topic is solved

How to use TestDisk to recover lost partition
Posts: 2
Joined: 03 Aug 2013, 01:51

Recovering LUKS EXT4 partition - incorrect size  Topic is solved

#1 Post by veken0m » 03 Aug 2013, 02:17

I'm not exactly sure how this happened but the partition table of one of my LUKS encrypted drives was lost although I saw using a hex viewer that the LUKS header is completely intact. I think it might been when I was installing Manjaro Linux and messed something up while partitioning or installing the boot loader. I'm certain I didn't touch that drive though...

Using test-disk I was able to find this partition and "recover it". The problem is that the size was not detected properly. Test-disk updated the partition table and it now shows up as 8.2 MB rather than ~2.0 TB. With "cryptsetup luksOpen" I am able to unlock the encrypted partition successfully although I am unable to read it's contents. Is it possible to fix the size in some way that would make the data recoverable? The encrypted partition spanned the entire drive. I'm really close to recovering it but I'm not sure what to try next...

Additional info:

Type: MS-DOS (MBR)
Encryption - aes-cbc-essiv:sha256
Partition Type - EXT4
DISK - ~1863GB

Recovered partition = Start 1, End 254, Size 16002 sectors
Last edited by veken0m on 07 Aug 2013, 03:56, edited 1 time in total.

Sponsored links

Posts: 2
Joined: 03 Aug 2013, 01:51

Re: Recovering LUKS EXT4 partition - incorrect size

#2 Post by veken0m » 07 Aug 2013, 03:54

Finally figured it out. Simply had to delete the partition using fdisk and create a new one of the proper length. The tricky part was to get fdisk to let me pick sectors < 2048. Starting it in old DOS-style disk block addressing mode via the "fdisk -c=dos -u=cylinders /dev/sdf" command did the trick.

Now I can successfully decrypt/mount the partition and all the data is intact! Feeling pretty boss right now :D.

User avatar
Posts: 2839
Joined: 18 Feb 2012, 17:19
Location: Ludwigsburg/Stuttgart - Germany

Re: Recovering LUKS EXT4 partition - incorrect size

#3 Post by Fiona » 07 Aug 2013, 06:13

Thanks for your feedback and providing your solution.
Ill set your topic as solved.



Who is online

Users browsing this forum: No registered users and 0 guests