# ext4 journal recovery

## dilbot

I have a disk which is no longer readable because for some reason the ext4 journal got corrupted.   

Is there any way to reconstruct the journal, or recover the files from the disk?

----------

## NeddySeagoon

dilbot,

You can attempt to mount the filesystem readonly, which should ignore the journal or you can try to mount the filesystem as ext2,

An ext2 mount will fail if you have used any of the non backwards compatible features, like barriers.

----------

## d2_racing

And if the mount still fail, then I don't know what you can do.

----------

## Hu

What files do you need to recover?  How big are they?  Depending on the size of the disk, the size of the file, and the type of data, you might be able to recover it by combing data blocks.  This is only really reliable for text files, and becomes more difficult as the size of the lost file increases.  Restoring from a backup would likely be faster and easier.

----------

## matze_na

From the mount man-page:

 *Quote:*   

> -r     Mount the filesystem read-only. A synonym is -o ro.
> 
>               Note that, depending on the filesystem type, state and kernel  behavior,  the  system  may
> 
>               still  write  to  the  device.  For  example,  Ext3 or ext4 will replay its journal if the
> ...

 

So try mounting with "-o ro,noload", and good luck  :Wink: 

----------

## d2_racing

And give us some news when you gonna try, because if it's working, then I'm gonna keep that trick for sure.

----------

## dilbot

Thanks for everyone's help.   Unfortunately mounting as read-only or as an ext2 file system 

didn't work, but they were good suggestions.

I wasn't able to find a linux solution for this, so I am embarrassed to say that I had to resort 

to a windows-based recovery program, which to my surprise handled the ext4 filesystem 

as advertised and I was able to get a full recovery.

I won't put the name of the package here lest someone misconstrue it as an elaborate 

advertisement, but if someone ends up in the same boat as I did then send me a message.

----------

## depontius

Just out of curiosity, and so perhaps the rest of us can avoid it, how did you get into your ext4 problem?

(ie, every now and then, I think I should spring for at least a cheap UPS for all of my systems, not just the servers.)

----------

## d2_racing

Or backup your data with a Stage 4 or Stage 5.

----------

## dilbot

depontius -  the disk failure was coincidental with a lightning strike next to my office which took down most 

of our machines.   I can only guess as to the mechanism that corrupted the ext4 journal.    The disk itself

seems fine.

----------

## Bircoph

1) ddrescue this entire disc (not partition) to some storage;

2) e2fsck it, try to use alternative superblocks as well;

----------

## d2_racing

ddrescue just to make sure that you can play with your HDD and if you crash something, you will have a valid backup to restore.

----------

