Rebuild the journal in a ext3 journaled filesystem

The symptom of a broken ext3 journal is that the system will boot normaly but after a while the filesystem will be remounted read only and according to the log there are problems reading a block in the journal.

Boot on a rescue cd or boot but make sure the filesystem is in read only mode.

In this example i use /dev/md0 (the software raid device), becuase when I had this problem it was an ext3 journaled filesystem residing on a software raid that was causing trouble.

Issue the following commands

# fsck /dev/md0
# tune2fs -O ^have_journaled /dev/md0
# mount -n -o remount,rw /dev/md0
# tune2fs -j /dev/md0
# mount -n -o remount,ro /dev/md0
# fsck /dev/md0
# reboot

The first tune2fs removes the current journal on the filesystem (-O ^have_journaled). The second tune2fs (-j) recreates it. In between the filesystem must be mounted read only in order for the new journal to be written.

Share

Tags: ,

This entry was posted on Thursday, September 3rd, 2009 at 12:08 pm and is filed under Linux/FreeBSD. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

 
 

Leave a Reply

You must be logged in to post a comment.