为什么无法挂载 RAID 阵列?

为什么无法挂载 RAID 阵列?

我有一个 RAID 阵列,如果我理解正确的话,它似乎工作正常:

# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md127 : active raid1 sdc1[0] sdb1[2]
      1951427392 blocks super 1.2 [2/2] [UU]
      
unused devices: <none>

和:

# mdadm -D /dev/md127
/dev/md127:
           Version : 1.2
     Creation Time : Mon Jun 30 11:34:10 2014
        Raid Level : raid1
        Array Size : 1951427392 (1861.03 GiB 1998.26 GB)
     Used Dev Size : 1951427392 (1861.03 GiB 1998.26 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

       Update Time : Mon Sep 13 22:35:53 2021
             State : clean 
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : resync

              Name : vm1:0  (local to host vm1)
              UUID : 0db83822:c53b4237:6ad8219b:40bc9f1c
            Events : 119625

    Number   Major   Minor   RaidDevice State
       0       8       33        0      active sync   /dev/sdc1
       2       8       17        1      active sync   /dev/sdb1

但是,如果我这样做:

# mount /dev/md127 /data/

然后什么也没有发生,并且系统日志中显示以下消息:

systemd[1]: media-storage.mount: Unit is bound to inactive unit dev-md0.device. Stopping, too.
systemd[1]: Unmounting /data...
systemd[1]: media-storage.mount: Succeeded.
systemd[1]: Unmounted /data.

当我运行时fdisk,它显示以下输出:

# fdisk -l
Disk /dev/sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk model: SanDisk SDSSDXPS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x98ee38b9

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 466862079 466860032 222.6G 83 Linux
/dev/sda2       466864126 468860927   1996802   975M  5 Extended
/dev/sda5       466864128 468860927   1996800   975M 82 Linux swap / Solaris


Disk /dev/sdb: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: ST2000DM001-1ER1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xe4628c28

Device     Boot      Start        End    Sectors  Size Id Type
/dev/sdb1             2048 3903119359 3903117312  1.8T fd Linux raid autodetect
/dev/sdb2       3903119360 3907024895    3905536  1.9G 82 Linux swap / Solaris


Disk /dev/sdc: 1.82 TiB, 2000397852160 bytes, 3907027055 sectors
Disk model: ST2000VX000-1CU1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x000ccc21

Device     Boot      Start        End    Sectors  Size Id Type
/dev/sdc1             2048 3903119359 3903117312  1.8T fd Linux raid autodetect
/dev/sdc2       3903119360 3907024895    3905536  1.9G 82 Linux swap / Solaris


Disk /dev/md127: 1.82 TiB, 1998261649408 bytes, 3902854784 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

看起来/dev/md127已经格式化了:

# mkfs /dev/md127
mke2fs 1.46.2 (28-Feb-2021)
/dev/md127 contains a ext4 file system
    last mounted on /data on Mon Sep 13 22:35:53 2021
Proceed anyway? (y,N)
  1. 这里发生了什么?
  2. 为什么系统日志的第一行提到了设备md0,而不是md127
  3. 我如何解决它?

答案1

“单元绑定到非活动单元 dev-md0.device”。消息,尤其是它引用了不同的设备名称,让我觉得 systemd 不知何故搞砸了。搜索证实了我的想法,并提供了一个解决方案,基本上是:

  1. 重新创建挂载点
  2. 跑步systemctl daemon-reload

(我搜索时发现的页面是:https://databaseinaction.com/article/systemd-unit-awscsrdb-mount-is-bound-to-inactive-unit-dev-nvme8n1-device-stopping-too/

我看不出步骤 1 会发生什么变化,但我不会声称了解 systemd。

相关内容