LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 08-08-2009, 08:53 PM   #1
airstuff
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Rep: Reputation: 0
After running "fsck"... No longer able to open encrypted drive... Any chance?...


On Debian/Lenny. My /home partition is on an external usb drive and encrypted. Power went out and system turned off. Logged back in, opened /home using "cryptsetup" and mounted fine but got message to do "fsck". I did: fsck -vy /dev/sda1 and got message that I couldn't do that. So I ended the session -> logged in as root in console -> unmounted /home partition -> closed the drive with "cryptsetup luksClose /dev/mapper/etc..." and ran "fsck -vy /dev/sda1"...

It went through about an hour (120GB drive) of "cleared" this and "fixed" this node and that node. At the end, I tried doing 'cryptsetup -y luksOpen /dev/sda1 ...' and it keeps asking for the passphrase. I rebooted, tried to open as usual and it keeps asking for a LUKS passphrase. Did I just hose the drive? (with no backup in about a month?)
 
Old 08-10-2009, 03:32 AM   #2
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
Quite possibly. Unfortunately fsck would not see the encrypted fs as an actual fs and would act upon it as it saw appropriate... likely hosing the entire fs. Sorry it's not the news you were hoping for.
 
Old 08-10-2009, 08:07 AM   #3
airstuff
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
clarification

Just so I understand... What you're saying is that "fsck" saw noise/random data (encryption) and proceeded to "fix" (or re-arrange) the file-system... and in the process of re-arranging rendered the "key" (luks passphrase) useless?

Yes... it is VERY bad news for me but it's a learning experience and I'm sure I'm not the only noob to do this Yet another reminder to keep current backups.
 
Old 08-10-2009, 10:37 AM   #4
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
In a manner of speaking, this is exactly what happened. If /dev/sda1 did not contain an ext3 filesystem, but fsck was told that it was one, it just goes ahead and tries to make sense of what it sees, with predictably unfortunate results.
 
Old 08-10-2009, 04:46 PM   #5
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,903

Rep: Reputation: 775Reputation: 775Reputation: 775Reputation: 775Reputation: 775Reputation: 775Reputation: 775
Gosh, is that really true? If you have an encrypted drive and there is a problem with it, does that mean that there are no tools you can use to fix it, or is it a matter of using fsck with some obscure options, or something?

Is there any refernce on this that I can look at to learn more as this seems to make encrypted volumes look like an accident waiting to happen.
 
Old 08-10-2009, 08:44 PM   #6
airstuff
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
accident waiting

Quote:
Originally Posted by salasi View Post
... this seems to make encrypted volumes look like an accident waiting to happen...
Yes... That's what I thought too. Learning the hard way is SO unpleasant. If there is ANY chance of recovery... I'd really appreciate the help. Thank you.
 
Old 08-11-2009, 04:30 AM   #7
GazL
Senior Member
 
Registered: May 2008
Posts: 3,392

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by salasi View Post
Gosh, is that really true? If you have an encrypted drive and there is a problem with it, does that mean that there are no tools you can use to fix it, or is it a matter of using fsck with some obscure options, or something?
No you can still use fsck in the usual manner. However, the important part is that you realise that your filesystem is on the luks device /dev/mapper/luksname and not the underlying partition.

To run fsck on a luks encrypted filesystem, the filesystem should be unmounted and the luks device unlocked (OPEN). Then you just run fsck on the /dev/mapper/luksname device in the usual manner.

Running fsck on the partition directly as airstuff has unfortunately discovered, is a very bad idea.
 
Old 08-11-2009, 06:33 AM   #8
airstuff
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
understood

Now I understand why I couldn't run fsck originally and got an error. The partition was mounted. All I should have done was unmount. Not unmount and close luks. Got it. Thank you for the very clear explanation.
 
  


Reply

Tags
encryption, fsck


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
"Can't open display" Error when running X applications remotely vmniza Linux - Networking 8 06-17-2011 05:22 AM
can longer copy files to my empty USB pen drive on DSL - "no space left on device" misterfever Linux - Newbie 11 03-18-2009 03:42 PM
LXer: "Ubuntu has the strongest chance to take Linux mainstream" LXer Syndicated Linux News 0 12-15-2008 02:30 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
No chance to send mail with "mutt"! emil+ Slackware 1 02-17-2006 05:26 AM


All times are GMT -5. The time now is 11:26 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration