Linux EXT3 superblock recovery


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Linux EXT3 superblock recovery
# 1  
Old 08-28-2008
Linux EXT3 superblock recovery

Is there a way to recover or rebuild the superblock of an ext3 filesystem with out loosing data?

Thanks
# 2  
Old 08-28-2008
Normally, there are backup copies of the superblock distributed throughout the filesystem. You can specify this to fsck with -b. To find out the block id, read the e2fsck man page. Essentialy, you run mke2fs as you originally did on the device, but with the -n option so that nothing is written to disk.
# 3  
Old 08-28-2008
I've tried that and here is what happens:

Code:
# fsck.ext3 -b 32768 /dev/sdb
Superblock has an invalid ext3 journal (inode 8).
Clear<y>?

I thought that command would update the superblock with a saved copy.

Is my interpretation of the man page correct?


If I answer 'y', then it says:
Quote:
*** ext3 journal has been deleted - filesystem is now ext2 only ***
Then it continues to try and fix additional inodes.

Does this mean that the superblock / filesystem is beyond recovering?

Last edited by Yogesh Sawant; 03-27-2011 at 02:11 PM.. Reason: added quote tags
# 4  
Old 08-28-2008
Sounds like the journal is beyond recovery, but the filesystem as such can be recovered. The journal contains stuff since the last journal sync, which is usually not a major amount of data. So there will likely be some data loss to stuff that happened just before the crash, but it might be worth doing. (Perhaps you can take a clone of the raw disk with dd so you can revert if this operation turns sour after all.)
# 5  
Old 08-28-2008
I let the fsck continue, answering 'y' to everything.
When it was finished I was able to mount the filesystem as ext2 and all data was still there.
# 6  
Old 08-28-2008
Quote:
Originally Posted by lochraven
I let the fsck continue, answering 'y' to everything.
When it was finished I was able to mount the filesystem as ext2 and all data was still there.
Great! Now you want to go back and re-create the journal. Do a man on tune2fs. It helps if you have a spare partition, but it is not necessary. You want to do something like:
Code:
tune2fs -j /dev/hdc

To enable the hdc with journaling.

Last edited by Yogesh Sawant; 03-01-2011 at 06:21 AM.. Reason: added code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Linux bad superblock on /dev/mapper/VolGroup-lv_root

Hi Friends . my linux try to start very slowly after give it this error: mount: wrong fs type, bad option, bad superblock on /dev/mapper/VolGroup-lv_root, missing codepage or helper program, or other error in some cases useful info is found in syslog - try dmesg : tail or so Kernel panic... (3 Replies)
Discussion started by: blackjuan
3 Replies

2. UNIX for Advanced & Expert Users

Superblock marked dirty

Good morning! I met a problem on a FS with AIX 5.3 It's not possible to mount the FS because of a dirty superblock. I tried few things without success. I need your help to solve my problem guys. Do you have any idea please? Thanks a lot drp01,/home/root # mount /GSPRES/data Replaying... (9 Replies)
Discussion started by: Castelior
9 Replies

3. Linux

CentOS Error: Superblock

Hi Guys, I really don't know where to put my query about this. And as a newbie, I think CentOS is closest to Ubuntu. Anyway, here's my dilemma. I have installed a VMWare - ESX 3.5 and installed CentOS 6 and cloned the CentOS 6. The first CentOS was working fine, when i cloned it, and the cloning... (2 Replies)
Discussion started by: init6_
2 Replies

4. Filesystems, Disks and Memory

Recovery of formatted ext3 partition

Hi! I have a really big problem right now. I (accidently) formatted a ext3 partition with "mkfs.ext3 /dev/sda1". The problem is that I REALLY need some files from there. The partition had a size of about 4GB, after accidently formatting it, I accidently rewrote Grub on it :wall: I hope I didn't... (3 Replies)
Discussion started by: al0x
3 Replies

5. UNIX for Advanced & Expert Users

linux system recovery after overriding connect() by "ld.so.preload"

dear fellows; i have used ld.so.preload file to override connect() function, dynamic library overriding, it did worked really fine ...... but i went on to struck in a situation ... within the overrided connect() i have used printf once to see IP and Port to whom the connect request is being... (1 Reply)
Discussion started by: mzeeshan
1 Replies

6. Filesystems, Disks and Memory

Linux HDD Recovery

Hello, I have my backup disks here because my server got hacked and we didn't like how liquidweb made the things. So we ask them to ship us the disk. They ran photorec and they got lots of .gz files from it. All accounts I would say. But 50% of them the .tar.gz files came corrupt. And is lefting... (2 Replies)
Discussion started by: asturmas
2 Replies

7. Red Hat

superblock error

can anybody help me to recovermy superblock , the recent power crash has done some stuff on my linux redhat 9 box . when i startup the machine iam getting the following error: The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it... (2 Replies)
Discussion started by: ppass
2 Replies

8. Solaris

How to corrupt a superblock?

I need to corrupt a superblock of a mounted device in a soalris m/c and check recovery from an alternate superblock. How can this be done? (2 Replies)
Discussion started by: sujathan
2 Replies

9. Linux

Help! Boot failure - corrupt superblock

Hi everyone, OK, I've made a monumental fsck-up of my linux installation AND I did not backup my data properly (idiot!), so I'm really up the proverbial without a paddle here. Basically the problem is I re-sized my /home partition (hda13) using Partition Magic 8.0, after doing so my mandrake... (0 Replies)
Discussion started by: alarmcall
0 Replies
Login or Register to Ask a Question