从磁盘错误中只读挂载后,如何重新挂载 ext3 fs 读写?

cag*_*nut 18 ext3 mount centos read-only

当 SAN 出现问题时,ext3 检测磁盘写入错误并以只读方式重新安装文件系统,这是一个相对常见的问题。这一切都很好,只有当 SAN 修复后,我才能弄清楚如何在不重新启动的情况下重新安装文件系统读写。

看:

[root@localhost ~]# multipath -ll
mpath0 (36001f93000a310000299000200000000) dm-2 XIOTECH,ISE1400
[size=1.1T][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
\_ 1:0:0:1 sdb 8:16  [active][ready]
\_ 2:0:0:1 sdc 8:32  [active][ready]
[root@localhost ~]# mount /dev/mapper/mpath0 /mnt/foo
[root@localhost ~]# touch /mnt/foo/blah
Run Code Online (Sandbox Code Playgroud)

一切都很好,现在我从它下面拉出 LUN。

[root@localhost ~]# touch /mnt/foo/blah
[root@localhost ~]# touch /mnt/foo/blah
touch: cannot touch `/mnt/foo/blah': Read-only file system
[root@localhost ~]# tail /var/log/messages
Mar 18 13:17:33 localhost multipathd: sdb: tur checker reports path is down
Mar 18 13:17:34 localhost multipathd: sdc: tur checker reports path is down
Mar 18 13:17:35 localhost kernel: Aborting journal on device dm-2.
Mar 18 13:17:35 localhost kernel: Buffer I/O error on device dm-2, logical block 1545
Mar 18 13:17:35 localhost kernel: lost page write due to I/O error on dm-2
Mar 18 13:17:36 localhost kernel: ext3_abort called.
Mar 18 13:17:36 localhost kernel: EXT3-fs error (device dm-2): ext3_journal_start_sb:   Detected aborted journal                      
Mar 18 13:17:36 localhost kernel: Remounting filesystem read-only
Run Code Online (Sandbox Code Playgroud)

它只认为它是只读的,实际上它甚至不存在。

[root@localhost ~]# multipath -ll
sdb: checker msg is "tur checker reports path is down"
sdc: checker msg is "tur checker reports path is down"
mpath0 (36001f93000a310000299000200000000) dm-2 XIOTECH,ISE1400
[size=1.1T][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][enabled]
 \_ 1:0:0:1 sdb 8:16  [failed][faulty]
 \_ 2:0:0:1 sdc 8:32  [failed][faulty]
[root@localhost ~]# ll /mnt/foo/
ls: reading directory /mnt/foo/: Input/output error
total 20
-rw-r--r-- 1 root root     0 Mar 18 13:11 bar
Run Code Online (Sandbox Code Playgroud)

它如何仍然记得那个 'bar' 文件在那里......神秘,但现在并不重要。现在我重新呈现LUN:

[root@localhost ~]# tail /var/log/messages
Mar 18 13:23:58 localhost multipathd: sdb: tur checker reports path is up
Mar 18 13:23:58 localhost multipathd: 8:16: reinstated
Mar 18 13:23:58 localhost multipathd: mpath0: queue_if_no_path enabled
Mar 18 13:23:58 localhost multipathd: mpath0: Recovered to normal mode
Mar 18 13:23:58 localhost multipathd: mpath0: remaining active paths: 1
Mar 18 13:23:58 localhost multipathd: dm-2: add map (uevent)
Mar 18 13:23:58 localhost multipathd: dm-2: devmap already registered
Mar 18 13:23:59 localhost multipathd: sdc: tur checker reports path is up
Mar 18 13:23:59 localhost multipathd: 8:32: reinstated
Mar 18 13:23:59 localhost multipathd: mpath0: remaining active paths: 2
Mar 18 13:23:59 localhost multipathd: dm-2: add map (uevent)
Mar 18 13:23:59 localhost multipathd: dm-2: devmap already registered
[root@localhost ~]# multipath -ll
mpath0 (36001f93000a310000299000200000000) dm-2 XIOTECH,ISE1400
[size=1.1T][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][enabled]
 \_ 1:0:0:1 sdb 8:16  [active][ready]
 \_ 2:0:0:1 sdc 8:32  [active][ready]
Run Code Online (Sandbox Code Playgroud)

很棒吧?它说 [rw] 就在那里。没那么快:

[root@localhost ~]# touch /mnt/foo/blah
touch: cannot touch `/mnt/foo/blah': Read-only file system
Run Code Online (Sandbox Code Playgroud)

好的,不会自动执行,我只是稍微推动一下:

[root@localhost ~]# mount -o remount /mnt/foo
mount: block device /dev/mapper/mpath0 is write-protected, mounting read-only
Run Code Online (Sandbox Code Playgroud)

你他妈的是:

[root@localhost ~]# mount -o remount,rw /mnt/foo
mount: block device /dev/mapper/mpath0 is write-protected, mounting read-only
Run Code Online (Sandbox Code Playgroud)

呜呜呜。

我尝试了各种不同的 mount/tune2fs/dmsetup 命令,但我不知道如何让它将块设备取消标记为写保护。重新启动将修复它,但我更愿意在线进行。一个小时的谷歌搜索也让我一无所获。救救我服务器故障。

小智 6

我最近刚遇到这个问题并通过重新启动解决了它,但经过进一步调查,似乎发出以下命令可能会解决它。

echo running > /sys/block/device-name/device/state
Run Code Online (Sandbox Code Playgroud)

我想您可能需要查看本文档中的第 25.14.4 节:更改在线逻辑单元的读/写状态,但是,我建议重新启动。

  • 在类似的问题中,我遇到了 /sys/block/device-name/device/state 已经设置为 'running' 并且上述命令没有解决问题。 (3认同)

The*_*tor 1

您认为它与本文档中标题为“为什么我的存储区域网络 (SAN) 上的 ext3 文件系统反复变为只读”的部分相关吗?

这是一篇很旧的文章,正在谈论光纤通道,但它可能与您的问题有关。