1

Thanks for choosing to take a look and help.

The problem is this:

I have a 1TB external hard disk with One encrypted partition(about 286 gb) - luks (I'll call this EP) One unencrypted partition(about 580 GB). - ntfs (i'll call this UEP)

The rest of the partitions were empty so they don't matter. I changed the UEP to "read only" in windows using "diskpart attributes volume set readonly". It seemed to work fine without issues, but after a short while there was some error and my partition table went missing partition manager said the whole drive was unalocated. So too did gparted and fdisk.

I tried using testdisk and it found all the missing partitions, When I wrote the recovered partition to disk, the UEP returned fine, but the encrypted partition is now inexplicably downsized to 2MB.

Fortunately I did some partition data backup earlier when I was trying to convert this from GUID to MBR, before all this and have some sector data which may help in recovery.

The Pre-Crash data created by Partition Wizard is Here (line 37/39 are the partitions I speak of).

The Post-Crash data is here (noticeably start of 37 and end of 39 match the luks partition from the Pre-Crash data)

The LUKS partition is this one:

letter: * PartID:  7 Start:   137117696 End:   737118207 Size:   600000512 FsId: 255 Label:                      ClusterSize:  -1 FreeSectors:           0 Primary: 1 Bootable: 0 BootVolume: 0 SystemVolume: 0

Is there any way to recover the LUKS partition while also keeping the 580 GB NTFS Drive?

I only need to recover the two drives that I have discussed here.

Please help me out with this.

-Danish

2
  • Post this text file and backup file: Backup partition table structure to text file & save to external device. sudo sfdisk -d /dev/sda > PTsda.txt If now MBR, you can use sfdisk to restore the partition to the partition table. But if encrypted LVM whether that will work is another question.
    – oldfred
    May 31, 2014 at 23:46
  • Thanks, this worked! sfdisk -d /dev/sdc > PTsda.txt edited the sector size in the text file, then: sfdisk /dev/sdc < PTsda.txt I'm not sure how to upvote your answer or mark it as the answer though Jun 1, 2014 at 7:29

2 Answers 2

0

To recreate the original partition scheme you will need to run a partitioning tool and create each partition with the start and end sectors from the backup data. That should restore the MBR exactly as it was. Try sfdisk:

sfdisk /dev/sdb -uM << EOF
2,114828,52
114830,19074,0
133904,585938,255
719842,1187896,7

You should check this for yourself. Each line is start,size,id with size in megabytes (-uM) based on your old partition data:

Start:        2048 End:   117585919 Size:   117583872 FsId: 52 Label:                      ClusterSize:   8 FreeSectors:   109144672 Primary: 1 Bootable: 0 BootVolume: 0 SystemVolume: 0
Start:   117585920 End:   137117695 Size:    19531776 FsId:  0 Label:                      ClusterSize:   1 FreeSectors:    19531776 Primary: 0 Bootable: 0 BootVolume: 0 SystemVolume: 0
Start:   137117696 End:   737118207 Size:   600000512 FsId: 255 Label:                      ClusterSize:  -1 FreeSectors:           0 Primary: 1 Bootable: 0 BootVolume: 0 SystemVolume: 0
Start:   737118208 End:  1953523711 Size:  1216405504 FsId:  7 Label:           Data-Drive ClusterSize:   8 FreeSectors:  1002478672 Primary: 1 Bootable: 0 BootVolume: 0 SystemVolume: 0

If you can not get the partition table recreated, have a look at this thread on recovering LUKS partitions.

3
  • I will attempt these and get back if it works, have stayed up all night trying to get this somehow fixed. Jun 1, 2014 at 2:34
  • So, I couldn't sleep while this was hanging :( -- I tried running sfdisk, but it seems to expect data in a format other than block size, while the information I have is block numbers afaik. Do you have any pointers to convertability? Is it reliably the same? Jun 1, 2014 at 6:19
  • The values I included in the answer should work for you. As far as I can see, the units from the Partition Wizard log are 1k so I divided by 1024 to get each start and size value.
    – bain
    Jun 1, 2014 at 9:14
0

The answer by oldfred worked for me :)

Thanks oldfred!

Post this text file and backup file: Backup partition table structure to text file & save to external device. sudo sfdisk -d /dev/sda > PTsda.txt If now MBR, you can use sfdisk to restore the partition to the partition table. But if encrypted LVM whether that will work is another question. – oldfred 7 hours ago

sfdisk -d /dev/sdc > PTsda.txt

edited the sector size in the text file, then:

sfdisk /dev/sdc < PTsda.txt

2
  • I was not sure with the LVM inside whether it would work or not. Glad you got it to work. I was going to include more info on editing text files & reinstalling it, but see you figured that out yourself with info from bain which would be similar to what I would have suggested.
    – oldfred
    Jun 1, 2014 at 17:37
  • Thank you for pointing me in the right direction though. I have been trying to fix this on my own for a couple of days now. In the end it took about 2 minutes to run the actions that actually solved the problem. I think the partition table back up was the most sensible thing I did - without actually knowing it would be so critical. in fact I remembered about it after 2 days. At the time when I made it on impulse, I thought 1kb max is all it would take, why not. Jun 1, 2014 at 18:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .