ubuntu的raid1热备份设置
raid1热备份设置
mdadm 怎么增加raid1 的 Spare Devices
清除旧元数据(如果必要):
如果新硬盘之前曾用于 RAID,需先清除超级块信息,否则可能会报错或导致冲突。
bash
# 假设新硬盘为 /dev/sdd
mdadm --zero-superblock /dev/sda4
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 missing
sudo mdadm /dev/md0 --fail /dev/sda4
mdadm /dev/md0 -G -n2
sudo mdadm /dev/md0 --grow --raid-devices=2
mdadm --detail /dev/md0
root@pi2b4:~# sudo mdadm /dev/md0 --remove /dev/sda4
root@pi2b4:~# sudo mdadm /dev/md0 --add /dev/sda4
root@pi2b4:~# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Sun Aug 23 15:47:47 2026
Raid Level : raid1
Array Size : 8379392 (7.99 GiB 8.58 GB)
Used Dev Size : 8379392 (7.99 GiB 8.58 GB)
Raid Devices : 2
Total Devices : 3
Persistence : Superblock is persistent
Update Time : Sun Aug 23 22:45:29 2026
State : clean
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
Consistency Policy : resync
Name : pi2b4:0 (local to host pi2b4)
UUID : cc685bff:b78efdff:0426f378:bfa30bec
Events : 653
Number Major Minor RaidDevice State
0 8 2 0 active sync /dev/sda2
2 8 3 1 active sync /dev/sda3
3 8 4 - spare /dev/sda4
root@pi2b4:~# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Sun Aug 23 15:47:47 2026
Raid Level : raid1
Array Size : 8379392 (7.99 GiB 8.58 GB)
Used Dev Size : 8379392 (7.99 GiB 8.58 GB)
Raid Devices : 2
Total Devices : 3
Persistence : Superblock is persistent
Update Time : Sun Aug 23 22:39:11 2026
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 1
Spare Devices : 0
Consistency Policy : resync
Name : pi2b4:0 (local to host pi2b4)
UUID : cc685bff:b78efdff:0426f378:bfa30bec
Events : 651
Number Major Minor RaidDevice State
0 8 2 0 active sync /dev/sda2
2 8 3 1 active sync /dev/sda3
3 8 4 - faulty /dev/sda4
root@pi2b4:~#
更多推荐

所有评论(0)