mdadm - 全新安装后如何重建 raid 阵列?

use*_*501 2 raid software-raid debian mdadm

我曾经在挂载点上有一个 raid1 阵列/mnt/md0,但是我重新安装了操作系统,现在我不知道如何重新组装它。

我相信我应该按照 的思路做一些事情mdadm --assemble,但我不知道如何将此信息添加到在重新启动之间保持不变的配置文件中。(我也不记得配置文件的位置。)

我首先按照此信息创建了数组

https://www.digitalocean.com/community/tutorials/how-to-create-raid-arrays-with-mdadm-on-debian-9

但没有有关如何使用现有磁盘创建阵列的信息。

有人能指出我正确的方向吗?

更新:我找到了这个配置文件:/etc/mdadm/mdadm.conf

这就是它包含的内容

# mdadm.conf
#
# !NB! Run update-initramfs -u after updating this file.
# !NB! This will ensure that initramfs has an uptodate copy.
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# 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
ARRAY /dev/md/0  metadata=1.2 UUID=(uuid here) name=(system name here):0

# This configuration was auto-generated on Fri, 19 Jun 2020 13:52:02 +0100 by mkconf
Run Code Online (Sandbox Code Playgroud)

use*_*501 5

这其实是微不足道的。

操作系统重新安装(相同版本的 debian 10)似乎在安装过程中检测到 RAID 磁盘。它表明有 2 个磁盘处于某种 raid 模式。我认为因为它看到了这一点,它也在网络安装期间从网络上提取了相关的软件包......无论如何......

sudo mdadm --assemble --scan
Run Code Online (Sandbox Code Playgroud)

这是(我猜?)填充配置文件的内容

这也在我的历史中,但可能不需要......sudo mdadm --assemble /dev/md0

然后安装(这就是我困惑的原因)

sudo mount /dev/md0 /mnt/md0
Run Code Online (Sandbox Code Playgroud)

不知道这是否会在重新启动之间持续存在?可能不会。我不知道要投入什么/etc/fstab才能实现这一目标。

编辑:要在启动时安装,我遵循了此https://askubuntu.com/questions/540202/mount-an-mdadm-raid-1-drive-at-boot

/dev/md0    /mnt/md0    ext4    defaults    0   0
Run Code Online (Sandbox Code Playgroud)