安装 Fedora 后使用 Mdadm 设置 Raid1

安装 Fedora 后使用 Mdadm 设置 Raid1

我以前从未在 Linux 中搞过 Raid,但在安装 Fedora Desktop 时我尝试设置 Raid1。起初一切似乎都很好,但可惜我看起来失败了。

这就是我的磁盘的制作过程。 (sda 是与此设置无关的驱动器,)

Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x5c72ed16

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1            2048 905715711 905713664 431.9G fd Linux raid autodetect
/dev/sdb2       905715712 958138367  52422656    25G fd Linux raid autodetect
/dev/sdb3  *    958138368 960235519   2097152     1G fd Linux raid autodetect
/dev/sdb4       960235520 976773119  16537600   7.9G  5 Extended
/dev/sdb5       960237568 976773119  16535552   7.9G fd Linux raid autodetect


Disk /dev/sdc: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x4d506287

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdc1            2048 905715711 905713664 431.9G fd Linux raid autodetect
/dev/sdc2       905715712 958140415  52424704    25G fd Linux raid autodetect
/dev/sdc3  *    958140416 960235519   2095104  1023M fd Linux raid autodetect
/dev/sdc4       960235520 976773119  16537600   7.9G  5 Extended
/dev/sdc5       960237568 976773119  16535552   7.9G fd Linux raid autodetect


Disk /dev/md127: 25 GiB, 26823622656 bytes, 52389888 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/md126: 1022 MiB, 1071644672 bytes, 2093056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/md125: 7.9 GiB, 8462008320 bytes, 16527360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/md124: 431.8 GiB, 463591178240 bytes, 905451520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

我的目标是让第二个硬盘作为精确的镜像,我创建的安装点是/, /home/, /boot, swap,并且我选择 RAID-1 作为它们的类型。从上图可以确定安装程序确实在两个磁盘上创建了相同的分区,但它们之间的同步被破坏。这是cat /proc/mdstat:

Personalities : [raid1] 
md124 : active raid1 sdc1[1]
      452725760 blocks super 1.2 [2/1] [_U]
      bitmap: 4/4 pages [16KB], 65536KB chunk

md125 : active raid1 sdc5[1] sdb5[0]
      8263680 blocks super 1.2 [2/2] [UU]

md126 : active raid1 sdb3[0]
      1046528 blocks super 1.2 [2/1] [U_]
      bitmap: 1/1 pages [4KB], 65536KB chunk

md127 : active raid1 sdb2[0]
      26194944 blocks super 1.2 [2/1] [U_]
      bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>

所以看起来只是swap按照我想要的方式出现。我的问题是,让其他分区效仿swap而不丢失数据的最佳方法是什么。

例如,运行这样的东西mdadm --assemble --run --force --update=resync /dev/md124 /dev/sdb1 /dev/sdc1会让这两个分区像这样设置吗swap

答案1

用户的评论wurtel起到了作用。做就是了:

mdadm -a /dev/md127 /dev/sdc2

例如,将 /dev/sdc2 添加到 /dev/md127 设备以补充已在其中使用的 /dev/sdb2。

至于所有分区中 sdb(x) 设置为 [0] 的问题,它们和我的 Raid1 正在完全同步运行。

相关内容