Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-29-2008, 12:30 AM   #1
LQ Newbie
Registered: Nov 2008
Posts: 2

Rep: Reputation: 0
Recover encrypted LUKS partition

I have recently experienced as slight yet painful problem with my Debian installation and I would like some piece of advice before I go any further.

I have a Debian system with two partitions, one is the boot partition (/dev/sda1) and the other is an encrypted partition (/dev/sda2) with LVM and two VGs (root and home).

And here's the thing: Yesterday, while booting with an USB pendrive running BT3, I meant to build a filesystem on the second partition of this pendrive, that is /dev/sdb2, when I inadvertently used /dev/sda2 instead. Meaning I run a "mkfs.ext3 /dev/sda2". Worst typo ever!

In the end, when I now boot my Debian system and Cryptsetup asks for the passphrase, it won't take it anymore issuing the error message "cryptsetup: unknown fstype, bad password or options?". Which I believe is normal since now /dev/sda2 appears as an ext3 partition in fdisk (don't know how it should appear though).

I believe the data is still there so I guess I "just" need to reconfigure the partition (the header maybe?) as they were, so it can accept the passphrase.

I have been messing with several tools (TestDisk, Gparted, fdisk, etc) but none of them seem to be able to do this and I rather don't mess up more with the disk in case I make things worse. I will buy a new disk next Monday and make a backup with dd to it, but I'd like to get more information before I go on.

Sorry for the speech and thanks for your help. Do not hesitate to ask if I have missed any important information that could help clarify the issue.
Old 11-29-2008, 03:45 AM   #2
Registered: Mar 2005
Location: UK
Distribution: opensuse 12.2 x86_64
Posts: 563

Rep: Reputation: 38
If you have completely reformatted your encrypted partition, unfortunately I think you have pretty much no chance of recovering any of the data on it. Attempting such a recovery would need the (expensive) assistance of a professional data recovery company, but even then I doubt they would be able to recover much of a fully formatted partition.
Old 11-29-2008, 12:43 PM   #3
LQ Newbie
Registered: Nov 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the reply, rjwilmsi. I guess it didn't look good in the first place and you confirm my worst fears... I better assume it!
Old 11-30-2008, 03:20 AM   #4
Senior Member
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: KirraMail Live Email Server
Posts: 1,284

Rep: Reputation: 61
yep, she's gone for good, sorry to say, but once you destroyed the encrypted block devices that the partitions are mounted under, these are the devices that actually do the encrypting/decryting, then there is no way back. Then once you format, you can then corrupt the already encrypted data, basically dealing yourself a double blow.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hosed my kernel - LUKS partition is not making it easier king111 Linux - General 1 11-23-2008 03:24 PM
Mounting LUKS encrypted drive from a failed pc: LVM2 error klearview Linux - Software 1 10-31-2008 04:34 AM
LXer: Automatically Unlock LUKS Encrypted Drives With A Keyfile LXer Syndicated Linux News 0 07-09-2008 04:40 PM
mount luks encrypted partition with kdm mattydee Slackware 2 01-28-2008 01:32 AM
Encrypted partition? hjles Slackware 1 01-25-2003 04:49 PM

All times are GMT -5. The time now is 03:14 PM.

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