驱动器丢失但重新启动后又恢复了,如何重建丢失的启动分区?

驱动器丢失但重新启动后又恢复了,如何重建丢失的启动分区?

我检查了我的服务器,发现缺少一个驱动器:

root@tiefenkaese ~ # lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
nvme1n1     259:0    0 476.9G  0 disk
├─nvme1n1p1 259:2    0    32G  0 part
│ └─md0       9:0    0    32G  0 raid1 [SWAP]
├─nvme1n1p2 259:3    0     1G  0 part
│ └─md1       9:1    0  1022M  0 raid1 /boot
└─nvme1n1p3 259:5    0 443.9G  0 part
  └─md2       9:2    0 443.8G  0 raid1 /
root@tiefenkaese ~ # cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md0 : active (auto-read-only) raid1 nvme1n1p1[1]
      33520640 blocks super 1.2 [2/1] [_U]
        resync=PENDING

md2 : active raid1 nvme1n1p3[1]
      465370432 blocks super 1.2 [2/1] [_U]
      bitmap: 3/4 pages [12KB], 65536KB chunk

md1 : active raid1 nvme1n1p2[1]
      1046528 blocks super 1.2 [2/1] [_U]

unused devices: <none>

重新启动后,两个驱动器均可再次使用,但第一个驱动器上缺少启动分区:

root@tiefenkaese ~ # lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
nvme0n1     259:0    0 476.9G  0 disk
├─nvme0n1p1 259:2    0    32G  0 part
│ └─md0       9:0    0    32G  0 raid1 [SWAP]
├─nvme0n1p2 259:3    0     1G  0 part
└─nvme0n1p3 259:4    0 443.9G  0 part
  └─md2       9:2    0 443.8G  0 raid1 /
nvme1n1     259:1    0 476.9G  0 disk
├─nvme1n1p1 259:5    0    32G  0 part
│ └─md0       9:0    0    32G  0 raid1 [SWAP]
├─nvme1n1p2 259:6    0     1G  0 part
│ └─md1       9:1    0  1022M  0 raid1 /boot
└─nvme1n1p3 259:7    0 443.9G  0 part
  └─md2       9:2    0 443.8G  0 raid1 /
root@tiefenkaese ~ # cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 nvme0n1p3[0] nvme1n1p3[1]
      465370432 blocks super 1.2 [2/2] [UU]
      bitmap: 3/4 pages [12KB], 65536KB chunk

md1 : active raid1 nvme1n1p2[1]
      1046528 blocks super 1.2 [2/1] [_U]

md0 : active (auto-read-only) raid1 nvme0n1p1[0] nvme1n1p1[1]
      33520640 blocks super 1.2 [2/2] [UU]
        resync=PENDING

unused devices: <none>

如何重建启动分区的 RAID?

答案1

我发现这真的很容易:

mdadm /dev/md1 -a /dev/nvme0n1p2

只需将 md1 添加到因某种原因失败的分区即可。

相关内容