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.

1 reply
  1. Mike van Engelen
    Mike van Engelen says:

    Great tutorial, however with me the following command failed:
    # tune2fs -O ^have_journaled /dev/sda3

    I used (and that worked):
    # tune2fs -O ^has_journal /dev/sda3

    (using CentOS 5.5)

    Though thanks for you contribution, helped allot!

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

2 + 20 =