Fixing ext3 read-only file system

When an ext3 file system reports being "read-only" quick action needs to be taken.

  • Power off the server ('init 0') to avoid data loss.
  • Boot into a rescue environment
  • Do not allow the rescue to mount the drives. For Red Hat, choose the 'Skip' option when prompted to find your RHEL installation.
  • Once in the rescue shell, locate the / file system (ex: /dev/sda5)
  • Remove the existing journal:

 sh#   tune2fs -O ^has_journal /dev/hda5
If this fails because of the needs_recovery flag preform the following
 sh# debugfs -w /dev/sda5
 debugfs: features ^needs_recovery
 debugfs: quit
  • Now, perform a fsck operation. Note, use the -y option with caution. You might want to just see how bad the corruption is first before you say "YES" to anything.

 sh#  fsck.ext2 -f /dev/sda5
  • Now, if your fsck looks good, rebuild the journal

 sh#  tune2fs -j /dev/sda5
  • Mount the filesystem and make sure its clean

 sh#  mkdir /mnt/fixed && mount -t ext3 /dev/sda5 /mnt/fixed
  • If done, then unmount the file system, and bring it back up.

 sh#  cd / ; umount /mnt/fixed  && reboot && exit

NB: Stolen from an old how-to at work in case the Wiki it's on goes way abruptly; I didn't write this -- Robot Terror

Reply

  • You can use Mediawiki syntax. It is possible that not all formatting options are supported at the moment.
    Links to other pages: [[Page Title]] or [[path/to/page|Title]].
    External links: http://example.com or [http://example.com some link title].
    Interwiki links: [[site:Page Title]].
    You can use the following interwiki links: path, gdo, wp

More information about formatting options