是否可以在不破坏分区的情况下重新创建 RAID 1 阵列?

是否可以在不破坏分区的情况下重新创建 RAID 1 阵列?

我之前使用 mdadm 创建了一个 RAID 1 阵列。其中一个驱动器出现故障,我已将其删除。我想在等待更换磁盘时继续使用剩余的磁盘。我没有最初用于创建数组的命令。

剩余的工作磁盘如下所示:

# fdisk -l /dev/sda
Disk /dev/sda: 7.28 TiB, 8001563222016 bytes, 15628053168 sectors
Disk model: ST8000VN004-3CP1
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: gpt
Disk identifier: ABC-123-etc

据我所知,没有分区,但我不太确定。


我尝试使用以下命令重新创建数组:

# mdadm --create --assume-clean --level=1 --raid-devices=1 /dev/md0 /dev/sda
mdadm: '1' is an unusual number of drives for an array, so it is probably
     a mistake.  If you really mean it you will need to specify --force before
     setting the number of drives.

说得通!所以尝试--force

# mdadm --create --assume-clean --level=1 --raid-devices=1 /dev/md0 /dev/sda --force
mdadm: partition table exists on /dev/sda
mdadm: partition table exists on /dev/sda but will be lost or
       meaningless after creating array
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
Continue creating array? n
mdadm: create aborted.

系统从不同的物理设备启动;这个数组纯粹是为了存储。

输出tail /etc/mdadm/mdadm.conf

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays

# This configuration was auto-generated on Fri, 17 Feb 2023 17:23:17 +0000 by mkconf
ARRAY /dev/md0 metadata=1.2 name=nas:0 UUID=d9953244:010850f9:e87c43c8:abc3e1f7

cat /proc/mdstat仅连接一个驱动器时的输出:

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
unused devices: <none>

mdadm --examine --scan以 root 身份运行时不产生输出


1. 有没有办法从这个单个物理磁盘创建阵列?

2. 当我收到替换驱动器时,如何将其恢复为 2 磁盘 RAID 1 阵列?

相关内容