Linux

更換驅動器後如何重建我的軟體 RAID1 陣列?

  • April 3, 2015

所以我有 1and1 專用主機和 RAID 1 設置。其中一個驅動器壞了,他們剛剛用一個好的驅動器替換了它。現在我需要建構,但我不確定哪個驅動器是舊驅動器,哪個驅動器是新的空白驅動器。請幫忙。這是說明:http ://help.1and1.com/servers-c37684/linux-server-c37687/system-recovery-c37690/how-do-i-rebuild-my-software-raid-array-after-a-驅動器更換-a730894.html

正如我正確理解的那樣,我*認為*我的舊驅動器是 /dev/sda,這意味著我應該繼續執行步驟 7:

sfdisk -d /dev/sda | sfdisk /dev/sdb

我對麼?這是我的控制台內容。請幫忙,謝謝。

[root@u16365582 ~]# fdisk -l

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x416e0acb

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         523     4194304   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2             523         784     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             784      121602   970470104   fd  Linux raid autodetect
Partition 3 does not end on cylinder boundary.

Disk /dev/md3: 993.8 GB, 993761296384 bytes
2 heads, 4 sectors/track, 242617504 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md1: 4294 MB, 4294901760 bytes
2 heads, 4 sectors/track, 1048560 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-usr: 34.4 GB, 34359738368 bytes
255 heads, 63 sectors/track, 4177 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-var: 871.9 GB, 871878361088 bytes
255 heads, 63 sectors/track, 105999 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-home: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@u16365582 ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda1[0]
     4194240 blocks [2/1] [U_]
     bitmap: 1/1 pages [4KB], 65536KB chunk

md3 : active raid1 sda3[1]
     970470016 blocks [2/1] [_U]
     bitmap: 206/232 pages [824KB], 2048KB chunk

unused devices: <none>
[root@u16365582 ~]#

/dev/sda 是您報告的“好”驅動器mdstat。它也是由 報告的具有有效分區數據的分區fdisk

如果您在需要保留其數據的位置之前沒有使用 /dev/sdb 進行任何操作,那麼按照指南的建議使用 sfdisk 將分區資訊複製到 /dev/sdb 應該是安全的。完成此操作後(並且可能在額外partprobe呼叫之後),您應該能夠分別mdadm manage [...] --add [...]訪問分區/dev/sdb1/dev/sdb3md1md3

引用自:https://serverfault.com/questions/509359