Linux EXT3 superblock recovery

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

Thanks

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.

I've tried that and here is what happens:

# 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:

Then it continues to try and fix additional inodes.

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

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.)

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:

tune2fs -j /dev/hdc

To enable the hdc with journaling.