几年前我第一次安装 Ubuntu 时,我使用 Ubuntu 备用安装盘设置了软件 RAID。RAID 中有两个 500 GB 的驱动器。
几天前,其中一个驱动器出现故障。我不得不在计算机的 BIOS 中切换驱动器的启动顺序,但除此之外,计算机运行正常。我的所有数据都安全地保存在剩余的驱动器上。
我买了一个新的驱动器来替换有缺陷的驱动器,并将其安装在我的电脑上。如果我使用 gParted 分区管理器查看它,我可以看到它在那里,但所有空间都未分配。
如何让 Ubuntu 将其视为 RAID 的一部分并开始镜像其他驱动器?
dave@homebase:~$ sudo fdisk -lu
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0x00078955
Device Boot Start End Blocks Id System
/dev/sda1 * 63 39070079 19535008+ fd Linux raid autodetect
/dev/sda2 39070080 46877669 3903795 fd Linux raid autodetect
/dev/sda3 46877670 781449794 367286062+ fd Linux raid autodetect
/dev/sda4 781449795 976768064 97659135 83 Linux
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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/sdb doesn't contain a valid partition table
Disk /dev/md2: 376.1 GB, 376084365312 bytes
2 heads, 4 sectors/track, 91817472 cylinders, total 734539776 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
Disk /dev/md1: 3997 MB, 3997368320 bytes
2 heads, 4 sectors/track, 975920 cylinders, total 7807360 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/md1 doesn't contain a valid partition table
Disk /dev/md0: 20.0 GB, 20003749888 bytes
2 heads, 4 sectors/track, 4883728 cylinders, total 39069824 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/md0 doesn't contain a valid partition table
dave@homebase:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md0 19G 4.5G 13G 26% /
none 1.8G 708K 1.8G 1% /dev
none 1.8G 752K 1.8G 1% /dev/shm
none 1.8G 332K 1.8G 1% /var/run
none 1.8G 0 1.8G 0% /var/lock
/dev/sda4 92G 211M 87G 1% /tmp
/dev/md2 345G 237G 91G 73% /home
192.168.0.12:/home/mythbuntu
651G 174G 444G 29% /home/dave/Mythbuntu
dave@homebase:~$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sda1[1]
19534912 blocks [2/1] [_U]
md1 : active (auto-read-only) raid1 sda2[1]
3903680 blocks [2/1] [_U]
md2 : active raid1 sda3[1]
367269888 blocks [2/1] [_U]
unused devices: <none>
答案1
您需要先将分区表从 sda 复制到 sdb。您可以手动执行此操作,或者这解释了一种巧妙的方法:
http://www.sharktooth.de/doku.php/linux:clone_disc_partition
完成后,您需要使用 raid 管理实用程序 mdadm 将分区添加到每个 raid:
mdadm -a /dev/md0 /dev/sdb1
mdadm -a /dev/md1 /dev/sdb2
mdadm -a /dev/md2 /dev/sdb3
这应该热添加新的分区并开始重建它们。
答案2
找到答案这里。
基本上,只需使用 gnome-disk-utility(在 Gnome 中的系统->管理下)。指向并单击。简单又方便。