Mdadm

fsck:為 /dev/md0 執行 fsck.ext4 時出現錯誤 2(沒有這樣的文件或目錄)

  • March 19, 2020

我有一個raid5,在意外停電後無法訪問。

細節:

# cat /proc/mdstat 
Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] 
md0 : active raid5 sdd[3] sdc[1] sdb[0]
     3906766848 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
     bitmap: 0/15 pages [0KB], 65536KB chunk

unused devices: <none>


# /sbin/mdadm --misc --test /dev/md0
# echo $?
0


# /sbin/mdadm --misc --detail /dev/md0
/dev/md0:
          Version : 1.2
    Creation Time : Wed May 29 18:43:39 2019
       Raid Level : raid5
       Array Size : 3906766848 (3725.78 GiB 4000.53 GB)
    Used Dev Size : 1953383424 (1862.89 GiB 2000.26 GB)
     Raid Devices : 3
    Total Devices : 3
      Persistence : Superblock is persistent

    Intent Bitmap : Internal

      Update Time : Thu Mar 19 19:02:08 2020
            State : clean 
   Active Devices : 3
  Working Devices : 3
   Failed Devices : 0
    Spare Devices : 0

           Layout : left-symmetric
       Chunk Size : 512K

Consistency Policy : unknown

             Name : Serwer:0  (local to host Serwer)
             UUID : 84a16ed7:c54e6e9f:f3ae512c:413b3a28
           Events : 4368

   Number   Major   Minor   RaidDevice State
      0       8       16        0      active sync   /dev/sdb
      1       8       32        1      active sync   /dev/sdc
      3       8       48        2      active sync   /dev/sdd


# ls -l /dev/md0
brw-rw---- 1 root disk 9, 0 mar 19 19:00 /dev/md0

然而:

/sbin/fsck /dev/md0
fsck from util-linux 2.33.1
fsck: error 2 (No such file or directory) while executing fsck.ext4 for /dev/md0


# mount /dev/md0 /media/storage/
mount: /media/storage: wrong fs type, bad option, bad superblock on /dev/md0, missing codepage or helper program, or other error.

/sbin/fsck /dev/md0``/sbin失敗是因為你沒有PATH,所以fsck找不到fsck.ext4

直接執行/sbin/fsck.ext4,就像添加sbinPATH

PATH="${PATH}:/sbin" /sbin/fsck /dev/md0

使用/sbin/fsck.ext4 /dev/md0完成了工作。沒想到/sbin/fsck /dev/md0FS會認不出來。

引用自:https://unix.stackexchange.com/questions/573809