我尝试在 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 阵列?
提前致谢。克里斯托夫