Rebuild journal on a ext3 file system

If you encounter the following problem;

  • The system boots normally but after some time, the some partitions are remounted as Read-Only.
  • You see some errors in the output of dmesg related to reading from the journal.
  • A manual file system check doesn’t solve the problem

you probably need to rebuild the journal of that ext3 file system. This can be done with the following steps:

Login as root directly on the (a remote connection won’t do it since we’ll enter single user mode).

Enter single user mode

# init 1

Remount the partition as read-only

 # remount -n -o remount,ro /dev/sda1

(replace /dev/sda1 by the name of the device which file system you want to fix)

Check the partition for errors

# fsck -y /dev/sda1

Remove the journal

# tune2fs -O ^has_journal /dev/sda1

Remount the partition as read-write

# mount -n -o remount,rw /dev/sda1

Recreate the journal

# tune2fs -j /dev/sda1

Remount the partition as read-only

 # remount -n -o remount,ro /dev/sda1

 Check the file system (and have the journal inode block info backed up

# fsck -f /dev/sda1

Reboot the system

# reboot

This should solve the problem !

One thought on “Rebuild journal on a ext3 file system

  1. Thanks for posting all of these simple to follow instructions!
    It’s easy to find what you’re looking for, without tons of distractive comments or conflicting threads when the site is “question based.”

Leave a Reply

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