Recovering LUKS EXT4 partition - incorrect size Topic is solved

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
veken0m
Posts: 2
Joined: 03 Aug 2013, 01:51

Recovering LUKS EXT4 partition - incorrect size

#1 Post by veken0m »

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.

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

Re: Recovering LUKS EXT4 partition - incorrect size

#2 Post by veken0m »

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
Fiona
Posts: 2835
Joined: 18 Feb 2012, 17:19
Location: Ludwigsburg/Stuttgart - Germany

Re: Recovering LUKS EXT4 partition - incorrect size

#3 Post by Fiona »

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

Fiona

Locked