Ubuntu Raid 发行新驱动器

Ubuntu Raid 发行新驱动器

我的服务器上有一个硬盘出现故障。我的 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 添加到 raid 中。我想我必须等到恢复完成后才能做其他事情?

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>

谢谢

答案1

您不必等到操作完成,现在就可以添加其他分区。由于您已经添加,因此sdb3您只需将sdb1和添加sdb2到其相应的md分区中

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

然后cat /proc/mdstat应该显示所有三个分区的正确状态。

如果您还没有这样做,您可能需要将 grub 重新安装到两个硬盘上。

相关内容