Centos7

重新掛載為讀寫

  • December 29, 2018

昨天我的 CentOS Linux 7 (Core) 伺服器遇到了硬碟問題。硬碟已被更換,但主分區處於只讀模式。

我正在嘗試使主分區再次可用(使其可讀寫),但遇到了很多問題。

掛載為 rw

我試過mount -n -o remount,rw /了,但這導致:

mount: / not mounted or bad option

      In some cases useful info is found in syslog - try
      dmesg | tail or so

dmesg | tail導致:

[  177.305240] Loading iSCSI transport class v2.0-870.
[  177.419722] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
[  177.446940] NFSD: starting 90-second grace period (net ffffffffa32fca00)
[  233.475427] systemd-readahead[2002]: Failed to open pack file: Read-only file system
[  267.629924] nfsd4: failed to purge old clients from recovery directory v4recovery
[  428.141830] EXT4-fs (md2): error count since last fsck: 1
[  428.141889] EXT4-fs (md2): initial error at time 1542775899: ext4_xattr_block_get:298: inode 6947097
[  428.142014] EXT4-fs (md2): last error at time 1542775899: ext4_xattr_block_get:298: inode 6947097
[  748.786866] EXT4-fs (md2): Couldn't remount RDWR because of unprocessed orphan inode list.  Please umount/remount instead
[  770.787648] EXT4-fs (md2): Couldn't remount RDWR because of unprocessed orphan inode list.  Please umount/remount instead

e2fsck

我嘗試使用以下方法修復孤立的 inode 列表:

e2fsck -f /dev/md2
e2fsck 1.42.9 (28-Dec-2013)
/dev/md2 has unsupported feature(s): metadata_csum
e2fsck: Get a newer version of e2fsck!

由於文件系統處於只讀模式,我無法下載更新版本的e2fsck.

tune2fs

我試過tune2fs -O ^metadata_csum /dev/md2並得到:

tune2fs 1.42.9 (28-Dec-2013)
tune2fs: Filesystem has unsupported read-only feature(s) while trying to open /dev/md2
Couldn't find valid filesystem superblock.

我怎樣才能讓這個分區再次被讀寫?

謝謝

您需要從一個足夠新的救援系統啟動,以支持您正在使用的文件系統功能。但是,鑑於文件系統顯然已損壞,即使(我假設)您使用的是提供冗餘的 RAID 級別,請為文件系統不可恢復做好準備。是時候預熱備份了。

引用自:https://serverfault.com/questions/946955