ext3是linux下较老的文件系统格式,但目前仍有少部分用户在使用ext3作为linux文件系统格式。
linux下ext3文件系统突然变成readonly 问题线索
#tail -100 /var/log/messages
Sep 1 04:02:21 www syslogd 1.4.1: restart.
Sep 1 11:22:16 www avahi-daemon[2691]: Invalid query packet.
Sep 1 11:22:57 www last message repeated 14 times
Sep 1 11:22:57 www avahi-daemon[2691]: Invalid query packet.
Sep 1 13:45:29 www kernel: ext3_abort called.
Sep 1 13:45:29 www kernel: EXT3-fs error (device hdb1): ext3_put_super: Couldn't clean up the journal
Sep 1 13:46:31 www kernel: kjournald starting. Commit interval 5 seconds
Sep 1 13:46:31 www kernel: EXT3 FS on hdb1, internal journal
Sep 1 13:46:31 www kernel: EXT3-fs: mounted filesystem with ordered data mode.
Sep 1 13:48:25 www kernel: printk: 5 messages suppressed.
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 9966270 in dir #9977438
Sep 1 13:48:25 www kernel: Aborting journal on device hdb1.
Sep 1 13:48:25 www kernel: ext3_abort called.
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_journal_start_sb: Detected aborted journal
Sep 1 13:48:25 www kernel: Remounting filesystem read-only
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 9966898 in dir #9977438
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 7323652 in dir #9977438
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 7323655 in dir #9977438
Sep 1 13:48:25 www kernel: __journal_remove_journal_head: freeing b_committed_data
Sep 1 13:48:25 www last message repeated 4 times
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 7324218 in dir #9977438
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 7324219 in dir #9977438
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 7324220 in dir #9977438
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 9965250 in dir #9977438
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 9965251 in dir #9977438
Sep 1 13:48:25 www kernel: EXT3-fs error (device hdb1): ext3_lookup: unlinked inode 9965252 in dir #9977438
经fsck -y 方式对该文件系统检修后,能稍微恢复可写入,文件写一段时间后,很快又会自动变成只读模式。
解决方式
由于当时记录的messages 错误日志仅有部分信息,并且未分析其他日志。目前判断这种一段时间后文件系统又变成只读的问题,跟磁盘物理状况不佳有关系,这时候更容易导致文件系统层进入保护状态(只读),以避免进一步破坏数据。
建议遇到这种情况,可以升级ext3文件系统到ext4,或者更换硬盘,迁移数据库到新硬盘分区。