LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 01-14-2012, 01:15 PM   #1
lupe
Member
 
Registered: Dec 2008
Distribution: Slackware, FreeBSD, NetBSD, Haiku
Posts: 60

Rep: Reputation: 2
Problem recovering encrypted partitions


Hi,

My problem started when I booted my laptop with an OpenBSD CD that I was trying to install to a SD card. OpenBSD installer didn't detect my SD card, but went to partition my disk (/dev/sda).
I didnt' confirm any change to the partition table of my disk but the installer changed the partition table of /dev/sda and I lost the configuration.
As I didn't have a backup for the MBR of /dev/sda, I used testdisk http://www.cgsecurity.org/ and recovered the structure of the disk.

Right now, fdisk reports:
# fdisk -l /dev/sda

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4483617d

Device Boot Start End Blocks Id System
/dev/sda1 63 16064 8001 83 Linux
/dev/sda2 * 81915435 112631714 15358140 83 Linux
/dev/sda3 112631715 259080254 73224270 f W95 Ext'd (LBA)
/dev/sda5 112631778 115700129 1534176 82 Linux swap
/dev/sda6 115700193 115716194 8001 83 Linux
/dev/sda7 259064253 259080254 8001 83 Linux

and cfdisk reports:
cfdisk (util-linux 2.19)

Disk Drive: /dev/sda
Size: 320072933376 bytes, 320.0 GB
Heads: 255 Sectors per Track: 63 Cylinders: 38913

Name Flags Part Type FS Type [Label] Size (MB)
--------------------------------------------------------------------------
sda1 Primary crypto_LUKS 8.23
Primary Free Space 41932.48
sda2 Boot Primary ext3 15726.74
sda5 Logical Linux swap 1571.03
sda6 Logical crypto_LUKS 8.23
Logical Free Space 73394.18
sda7 Logical crypto_LUKS 8.23
Pri/Log Free Space 187423.85*


I can boot the machine (/dev/sda2) but the encrypted partitions are not available: /home (/dev/sda6), /opt (/dev/sda7) and /mnt/cr1 (/dev/sda1).

As you can see, for each of the three encrypted partitions, testdisk recovered the partition as having only circa 8MB and left the rest of the original partition as 'Free Space'.

What can I do to have each one of these partitions consider all the space next to them as belonging to them?

As a note, I did a 'dd' of the whole disk before using testdisk to a file.
 
Old 01-17-2012, 04:52 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I'm curious what the 8MB section contains and if OpenBSD has done more than write the MBR (like try initializing file systems) as it isn't clear from your post at which point you cut off the process. And I think that even if you would have saved sfdisk output prior to installing OpenBSD (so you could re-establish partition boundaries), if even the smallest part of a LUKS-encrypted partition (esp. the first 2MB where the LUKS header resides) has been overwitten you'd be SOL. LUKS does allow for a backup header to be written at the end of the encrypted partition but unfortunately that requires manual initialization, it isn't what a default installation would offer you as far as I know.
 
  


Reply

Tags
partition


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Recovering grub after Windows installation. Encrypted partitions and LVM. 1937 Debian 6 11-04-2010 05:22 PM
Recovering data from password encrypted volume akumarkind Fedora 6 03-09-2010 01:16 AM
Recovering data from password encrypted volume akumarkind Linux - Enterprise 3 03-06-2010 01:35 AM
Recovering data from password encrypted volume akumarkind Linux - Software 1 03-04-2010 08:45 AM
Recovering data from password encrypted volume akumarkind LQ Suggestions & Feedback 1 03-04-2010 08:41 AM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 02:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration