使用 MSADM 设置 RAID1 - lsblk 中第二个硬盘的意外类型

Setup a RAID1 with MSADM - unexpected type for second hd in lsblk

我尝试在 Raspberrypi 4 上使用 mdadm 设置 RAID1。我不确定 raid 是否配置正确。

这是 lsblk 在设置之前显示的内容:

pi@e11:/dev $ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk
sdb           8:16   0 931.5G  0 disk
mmcblk0     179:0    0  59.5G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  59.2G  0 part /

这是我所做的:

pi@e11:/dev $ sudo parted /dev/sda "mklabel gpt"
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
Information: You may need to update /etc/fstab.

pi@e11:/dev $ sudo parted /dev/sdb "mklabel gpt"
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
Information: You may need to update /etc/fstab.

pi@e11:/dev $ sudo parted /dev/sda "mkpart primary ext4 1M -1"
Information: You may need to update /etc/fstab.

pi@e11:/dev $ sudo parted /dev/sdb "mkpart primary ext4 1M -1"
Information: You may need to update /etc/fstab.

pi@e11:/dev $ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk
└─sda1        8:1    0 931.5G  0 part
sdb           8:16   0 931.5G  0 disk
└─sdb1        8:17   0 931.5G  0 part
mmcblk0     179:0    0  59.5G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  59.2G  0 part /
pi@e11:/dev $ sudo parted /dev/sda "set 1 raid on"
Information: You may need to update /etc/fstab.

pi@e11:/dev $ sudo parted /dev/sdb "set 1 raid on"
Information: You may need to update /etc/fstab.

pi@e11:/dev $ sudo parted -s /dev/sda print
Model: TOSHIBA External USB 3.0 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  1000GB  1000GB               primary  raid

pi@e11:/dev $ sudo parted -s /dev/sdb print
Model: TOSHIBA External USB 3.0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  1000GB  1000GB               primary  raid

pi@e11:/dev $ sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
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? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

Lsblk 之后:

pi@e11:/dev $ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda           8:0    0 931.5G  0 disk
└─sda1        8:1    0 931.5G  0 part
  └─md0       9:0    0 931.4G  0 raid1
sdb           8:16   0 931.5G  0 disk
└─sdb1        8:17   0 931.5G  0 part
mmcblk0     179:0    0  59.5G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part  /boot
└─mmcblk0p2 179:2    0  59.2G  0 part  /

我希望 sdb1 也应该看起来像 sda1,不是吗?

sda           8:0    0 931.5G  0 disk
└─sda1        8:1    0 931.5G  0 part
  └─md0       9:0    0 931.4G  0 raid1
sdb           8:16   0 931.5G  0 disk
└─sdb1        8:17   0 931.5G  0 part
  └─md0       9:0    0 931.4G  0 raid1

如果我是对的。我还能做什么将 sdb1 添加到 raid 阵列?

提前致谢。 克里斯托夫

事实证明,Raspi 4 和两个磁盘的电源 (15W) 不够用。使用活动的 USB 集线器,现在一切正常。