My blog has moved!

You should be automatically redirected. If not, visit
http://benohead.com
and update your bookmarks.

Monday, October 17, 2011

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 !

No comments:

Post a Comment