LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 04-29-2007, 02:32 PM   #1
LinuxGeek
Member
 
Registered: Jun 2002
Posts: 302

Rep: Reputation: 31
Non-destructively running fsck


Hi,

I have an ext3 partition that became corrupted after an unclean shutdown (the power cut). My machine no longer boots and using Knoppix, when I try to mount the root partition, it gives me the following message:

mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
or too many mounted file systems

Is there any way to run fsck so that it writes changes to the filesystem into a temporary file and doesn't actually change the real filesystem so that I know what fsck will do to the partition (I've had experience with fsck where it hosed the filesystem) and know is the fsck operation will leave my data intact? I know I can do this by dd'ing the partition, but sometimes, it's not practical to dd a 50+ GB partition. Thank you for your help.
 
Old 04-29-2007, 04:04 PM   #2
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
How about using the -N switch, and >> to a file? (of course make sure the file is on another drive or whatever)
So like fsck /dev/hda6 -v -N >> tempfile.txt

v = verbose, and N = Don't actually do it, just show what would be done.

NOTE: read 'man fsck' to be sure for yourself that this exactly is what you want.

Last edited by GrapefruiTgirl; 04-29-2007 at 04:09 PM.
 
Old 04-30-2007, 01:49 AM   #3
LinuxGeek
Member
 
Registered: Jun 2002
Posts: 302

Original Poster
Rep: Reputation: 31
Thanks GrapefruiTgirl. Do you know if this would then allow me to mount the filesystem afterwards to see if any damage had been done? I get a feeling that -N would just show you what would be done but wouldn't allow you to mount the filesystem afterwards. Any ideas?
 
Old 04-30-2007, 09:36 AM   #4
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Well.. I'm no expert by any means, but... If it's the root filesystem, it will automatically run fsck during boot, to fix it.
Mounting it and having a look around, you might not really be able to see any damage yourself. It might 'look' fine, but still have errors somewhere.
If you want to mount it, boot a live CD or load another OS on your machine, then mount this messed up partition 'Read-Only' and then CHROOT into it.
Again, as far as mounting it in the circumstances that it is the root partition of a system which you are actually booting, it's going to want to run fsck. There *might* be a flag you can set on either fsck or on reboot that will skip fsck, but I can't recall if/what it is.
Success stories vary, but personally I haven't had anything go terribly wrong with fsck; I haven't lost any data or files, with the exception of stuff like the open status of my browser for crash recovery, or files I have had open in 'kwrite' when I rebooted, that sort of thing. But, I use Ext2 and e2fsck. Don't know what difference it makes, but, that's just my own experience.

Why not just TRY what you want: run fsck -N and then remount it RO or RW, and see what happens?
 
  


Reply


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
Running fsck at bootup swampdog2002 Slackware 5 08-30-2006 08:34 PM
How to fsck / while system running LinuxGeek Linux - Software 2 07-19-2005 10:43 AM
Running fsck clinton Linux - Software 2 01-25-2005 07:12 PM
mount -r while fsck is running? aaccomazzi Linux - Hardware 1 10-20-2004 04:00 PM
running fsck rbrooks Linux - Newbie 1 05-16-2002 04:30 PM


All times are GMT -5. The time now is 09:17 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