Linux

Raid1 使用 Mdadm 設置後安裝 Fedora

  • October 16, 2018

我以前從未在 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嗎?

使用者的評論wurtel起到了作用。做就是了:

mdadm -a /dev/md127 /dev/sdc2

例如,將 /dev/sdc2 添加到 /dev/md127 設備以補充那裡已經在使用的 /dev/sdb2。

至於 sdb(x) 被設置為的問題

$$ 0 $$在所有分區中,它們和我的 Raid1 完全同步執行。

引用自:https://unix.stackexchange.com/questions/475804