Ubuntu

Ubuntu Raid 發行新驅動器

  • September 6, 2016

我的伺服器上的硬碟驅動器出現故障。我在 linux 方面速度很慢,所以請多多包涵。我換了驅動。

我跑了這個:

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

然後我跑了:

fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024c28

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    50333696    25165824+  fd  Linux raid autodetect
/dev/sda2        50335744    51384320      524288+  fd  Linux raid autodetect
/dev/sda3        51386368  3907027120  1927820376+  fd  Linux raid autodetect

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024c28

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    50333696    25165824+  fd  Linux raid autodetect
/dev/sdb2        50335744    51384320      524288+  fd  Linux raid autodetect
/dev/sdb3        51386368  3907027120  1927820376+  fd  Linux raid autodetect

Disk /dev/md2: 1974.0 GB, 1973953691648 bytes
2 heads, 4 sectors/track, 481922288 cylinders, total 3855378304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table

不知何故,我得到了這個,但是,我很迷茫:

cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 sdb3[2] sda3[0]
     1927689152 blocks super 1.2 [2/1] [U_]
     [====>................]  recovery = 23.7% (457343168/1927689152) finish=190.9min speed=128320K/sec

md0 : inactive sda1[0](S)
     25149440 blocks super 1.2

md1 : inactive sda2[0](S)
     524032 blocks super 1.2

unused devices: <none>

我正在嘗試將 md0 添加到突襲中。我想我必須等到恢復完成後才能做其他事情?

UPDATE1 我走得更遠了,但不確定 md1

# mdadm --stop /dev/md0
mdadm: stopped /dev/md0
# mdadm --stop /dev/md1
mdadm: stopped /dev/md1
# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 sdb3[2] sda3[0]
     1927689152 blocks super 1.2 [2/1] [U_]
     [=====>...............]  recovery = 27.8% (536125376/1927689152) finish=179.4min speed=129207K/sec

unused devices: <none>
mdadm --assemble --scan
mdadm: /dev/md/0 has been started with 1 drive (out of 2).
mdadm: /dev/md/1 has been started with 1 drive (out of 2).

# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md1 : active raid1 sda2[0]
     523968 blocks super 1.2 [2/1] [U_]

md0 : active raid1 sda1[0]
     25149312 blocks super 1.2 [2/1] [U_]

md2 : active raid1 sdb3[2] sda3[0]
     1927689152 blocks super 1.2 [2/1] [U_]
     [=====>...............]  recovery = 27.8% (537003968/1927689152) finish=198.8min speed=116544K/sec

unused devices: <none>

謝謝你

您不必等到操作完成,您現在可以添加其他分區。既然你已經添加了sdb3,你只需要將sdb1and添加sdb2到它們對應md的 s

mdadm --add /dev/md0 /dev/sdb1
mdadm --add /dev/md1 /dev/sdb2

然後cat /proc/mdstat應該顯示所有三個分區的正確狀態。

如果您還沒有這樣做,您可能需要將 grub 重新安裝到兩個硬碟上。

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