You are not logged in.

#1 2011-08-27 22:40:51

2891066
Member
Registered: 2011-08-17
Posts: 11

How to fix a broken partition (without wiping everything out)

The power went out today (thanks, Hurricane Irene), and when I rebooted it threw an error message that one of my partitions had failed a disk check.  My installation is split across 3 partitions: /boot (ext2, 100mb, sda2), /home (ext4, 17gb, sda3), and / (ext4, 17 gb, sda4).  If I recall correctly it said sda3 was corrupted. 

Anyway, it prompted me to remount as rw and run fsck, which I did.  Fsck found some stuff, then stopped for a reason I can't remember.  I tried rebooting and now it says it can't detect what file system type the kernel is.

So, if I boot from the Arch usb disk, what commands can I run to figure out what's actually messed up and fix it?  While I'm pretty comfortable on the command line, recovering disks is something I don't have experience with, so I don't know what commands to use.  I also have trouble taking the man page for a command and translating that to something that is usable for me.

The power is still out as I write this, so for now I can't provide any additional details or try anything.

Offline

#2 2011-08-27 23:12:49

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: How to fix a broken partition (without wiping everything out)

2891066 wrote:

it prompted me to remount as rw and run fsck, which I did.

Yikes!  I hope that's a typo.

Run fsck again, on the unmounted partition and hope all comes out well.  You may even run it twice.  And hope some more.

fsck cannot keep track of file system changes if the disk is being written while it's being checked.

man 8 fsck.ext4 wrote:

Note that in general it is not safe to run e2fsck on mounted  filesystems.   The only  exception  is if the -n option is specified, and -c, -l, or -L options are not specified.   However, even if it is safe to do so , the  results  printed  by e2fsck are not valid if the filesystem is mounted.   If e2fsck asks whether or not you should check a filesystem which is mounted, the only correct  answer  is ``no''.   Only  experts  who  really  know  what  they are doing should consider answering this question in any other way.

—The italics are my edits.

Offline

#3 2011-08-27 23:33:57

2891066
Member
Registered: 2011-08-17
Posts: 11

Re: How to fix a broken partition (without wiping everything out)

thisoldman wrote:

Yikes!  I hope that's a typo.

'Fraid not.  Sounds like I might be SOL.  Ah well, it's a learning process.  I'll see if I can at least save /home.

Thanks for the reply.

Offline

#4 2011-08-28 00:56:16

2891066
Member
Registered: 2011-08-17
Posts: 11

Re: How to fix a broken partition (without wiping everything out)

An update:

Apparently I somehow managed to wipe out all the superblocks associated with /dev/sda3 (/home).  I'm unable to mount the partition even if I specify the fs, and parted won't even try to rescue it.  More interestingly, the command "dumpe2fs /dev/sda3 | grep superblock" returns this ominous output: "Bad magic number in super-block while trying to open /dev/sda3.  Couldn't find valid filesystem in superblock."

I suspect this means the partition is toast, but I want to check before I wipe it and re-write the partition.

Offline

#5 2011-08-28 01:48:33

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: How to fix a broken partition (without wiping everything out)

You could try 'testdisk'  It's in extra and is also available on the SystemRescueCD.  'testdisk' is a tool to recover lost partitions, but I wouldn't hold much hope for it to be successful for you.

Included with testdisk is 'photorec'.  It's a file recovery tool.  It ignores the filesystem and tries to recover the data recorded.  It isn't limited to just image files, many other file types: text, office formats, mp3 and other files can be recovered.  I've saved other people's "deleted" files on several occasions using it.

Offline

Board footer

Powered by FluxBB