我刚刚将我的 Ubuntu 服务器(作为 NAS)从 10.04 升级到 12.04。由于两者都是 LTS 版本,所以我没想到会有什么问题,而且……也没有做任何备份。我的错。
升级后,服务器没有启动,grub rescue 向我发出了问候。
最初我有 4 个 RAID 阵列:第一个,10GB 用于系统 /dev/md0,是在 RAID1 模式下从 /dev/sd[bcdef]1 组装而成的。第二个,10GB 用于缓存的 /dev/md1,是在 RAID1(?) 模式下从 /dev/sd[bcdef]2 组装而成的。第三个,/dev/md5,是在 RAID5 模式下从 /dev/sd[bcdef]6 组装而成的。所有分区每个 500GB。最后一个,/dev/md6,是在 RAID6 模式下从 /dev/sd[bcdef]5 组装而成的。所有分区每个 500GB。
由于我没有 5TB(甚至 3.5TB)的介质来制作备份,因此我使用最小 CD 在 /dev/sda 上安装了一个干净的 Ubuntu 服务器系统。我无法启动,但这可能是我的硬件部分出现故障,我的硬件已经过时,并且没有从其他硬盘启动的选项。因此我运行 XUbuntu live cd,从中我能够挂载其中一个系统分区,并对系统文件进行完整备份。然后我在设置 /dev/sd[bcdef]1 RAID1 时正确识别的设备上安装了 12.04。不幸的是,系统实际上仅安装在 /dev/sde1 上,忽略了 raid 布局。之后,系统无法启动。由于害怕再碰任何东西,我再次拿起 XUbuntu live cd,从中我可以收集以下诊断数据。
我只想恢复 /dev/md5 和 /dev/md6。
看起来安装程序弄乱了 /dev/sde 上的超级块。我希望这不会造成致命影响...
#sudo /usr/share/mdadm/mkconf
...
# definitions of existing MD arrays
ARRAY /dev/md124 UUID=01b9a5fe:1be857d7:c20db638:73a0ec38
ARRAY /dev/md127 UUID=00000000:00000000:00000000:00000000
spares=2
ARRAY /dev/md/6 metadata=1.2 UUID=2a8fd2df:3ad53552:e8b80ecf:a46d93a2 name=pieciodysk:6
ARRAY /dev/md/5 metadata=1.2 UUID=a3945c40:73237cd6:3d61998e:8f773d03 name=pieciodysk:5
ARRAY /dev/md127 UUID=00000000:00000000:00000000:00000000
spares=4
ARRAY /dev/md/6 metadata=1.2 UUID=2a8fd2df:3ad53552:e8b80ecf:a46d93a2 name=pieciodysk:6
spares=4
ARRAY /dev/md/5 metadata=1.2 UUID=a3945c40:73237cd6:3d61998e:8f773d03 name=pieciodysk:5
spares=4
fdsik /dev/sdb:
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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: 0x000c3e8a
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 19531775 9764864 fd Linux raid autodetect
/dev/sdb2 19531776 21485567 976896 fd Linux raid autodetect
/dev/sdb3 21485568 1953510662 966012547+ 5 Extended
/dev/sdb5 21485631 987490082 483002226 fd Linux raid autodetect
/dev/sdb6 987490146 1953510662 483010258+ fd Linux raid autodetect
fdsik /dev/sdc:
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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
Device Boot Start End Blocks Id System
/dev/sdc1 * 63 19535039 9767488+ fd Linux raid autodetect
/dev/sdc2 19535040 21494969 979965 fd Linux raid autodetect
/dev/sdc3 21494970 1953520064 966012547+ 5 Extended
/dev/sdc5 21495033 987499484 483002226 fd Linux raid autodetect
/dev/sdc6 987499548 1953520064 483010258+ fd Linux raid autodetect
fdsik /dev/sdd:
Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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
Device Boot Start End Blocks Id System
/dev/sdd1 * 2048 19531775 9764864 fd Linux raid autodetect
/dev/sdd2 19531776 21485567 976896 fd Linux raid autodetect
/dev/sdd3 21485568 1953510662 966012547+ 5 Extended
/dev/sdd5 21485631 987490082 483002226 fd Linux raid autodetect
/dev/sdd6 987490146 1953510662 483010258+ fd Linux raid autodetect
fdsik /dev/sde:
Disk /dev/sde: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders, total 2930277168 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
Device Boot Start End Blocks Id System
/dev/sde1 * 63 19535039 9767488+ fd Linux raid autodetect
/dev/sde2 19535040 21494969 979965 fd Linux raid autodetect
/dev/sde3 21494970 2930272064 1454388547+ 5 Extended
/dev/sde5 21495033 987499484 483002226 fd Linux raid autodetect
/dev/sde6 987499548 1953520064 483010258+ fd Linux raid autodetect
/dev/sde7 1953520128 2930272064 488375968+ 83 Linux
fdsik /dev/sdf:
Disk /dev/sdf: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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: 0x3743db4a
Device Boot Start End Blocks Id System
/dev/sdf1 63 19535039 9767488+ fd Linux raid autodetect
/dev/sdf2 19535040 21494969 979965 fd Linux raid autodetect
/dev/sdf3 21494970 1953520064 966012547+ 5 Extended
/dev/sdf5 21495033 987499484 483002226 fd Linux raid autodetect
/dev/sdf6 987499548 1953520064 483010258+ fd Linux raid autodetect
/dev/sda 是一个辅助磁盘,不用于任何特殊用途。
sudo mdadm --检查 /dev/sdb5
/dev/sdb5:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 2a8fd2df:3ad53552:e8b80ecf:a46d93a2
Name : pieciodysk:6
Creation Time : Sun Sep 12 19:36:21 2010
Raid Level : -unknown-
Raid Devices : 0
Avail Dev Size : 966004180 (460.63 GiB 494.59 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : active
Device UUID : 64b1c028:14da81bd:06bfb40b:c30ff7d6
Update Time : Tue Sep 11 17:05:27 2012
Checksum : e4b0a0dd - correct
Events : 1
Device Role : spare
Array State : ('A' == active, '.' == missing)
sudo mdadm --检查 /dev/sdc5
/dev/sdc5:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 2a8fd2df:3ad53552:e8b80ecf:a46d93a2
Name : pieciodysk:6
Creation Time : Sun Sep 12 19:36:21 2010
Raid Level : -unknown-
Raid Devices : 0
Avail Dev Size : 966004180 (460.63 GiB 494.59 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : active
Device UUID : 6b8374d4:4a4f71a1:23f7fa5c:7a7953c1
Update Time : Tue Sep 11 17:05:27 2012
Checksum : aff689f7 - correct
Events : 1
Device Role : spare
Array State : ('A' == active, '.' == missing)
sudo mdadm --检查 /dev/sdd5
/dev/sdd5:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 2a8fd2df:3ad53552:e8b80ecf:a46d93a2
Name : pieciodysk:6
Creation Time : Sun Sep 12 19:36:21 2010
Raid Level : -unknown-
Raid Devices : 0
Avail Dev Size : 966004180 (460.63 GiB 494.59 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : active
Device UUID : 017925d6:8db5b2ca:8795d93e:c0205358
Update Time : Tue Sep 11 17:05:27 2012
Checksum : 53c72b78 - correct
Events : 1
Device Role : spare
Array State : ('A' == active, '.' == missing)
sudo mdadm --检查 /dev/sde5
/dev/sde5:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : 2a8fd2df:3ad53552:e8b80ecf:a46d93a2
Name : pieciodysk:6
Creation Time : Sun Sep 12 19:36:21 2010
Raid Level : raid6
Raid Devices : 5
Avail Dev Size : 966004180 (460.63 GiB 494.59 GB)
Array Size : 2898012288 (1381.88 GiB 1483.78 GB)
Used Dev Size : 966004096 (460.63 GiB 494.59 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : clean
Device UUID : a9a93188:1c1ae289:b56398c7:6be226cb
Internal Bitmap : 2 sectors from superblock
Update Time : Mon Sep 10 08:31:33 2012
Checksum : c0a8031a - correct
Events : 80390
Layout : left-symmetric
Chunk Size : 64K
Device Role : Active device 3
Array State : AAAAA ('A' == active, '.' == missing)
sudo mdadm --检查 /dev/sdf5
/dev/sdf5:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 2a8fd2df:3ad53552:e8b80ecf:a46d93a2
Name : pieciodysk:6
Creation Time : Sun Sep 12 19:36:21 2010
Raid Level : -unknown-
Raid Devices : 0
Avail Dev Size : 966004180 (460.63 GiB 494.59 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : active
Device UUID : d7b87b43:298cdd3d:3f900370:198f3f48
Update Time : Tue Sep 11 17:05:27 2012
Checksum : 555eaafb - correct
Events : 1
Device Role : spare
Array State : ('A' == active, '.' == missing)
sudo mdadm --检查 /dev/sdb6
/dev/sdb6:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : a3945c40:73237cd6:3d61998e:8f773d03
Name : pieciodysk:5
Creation Time : Sun Sep 12 19:36:39 2010
Raid Level : -unknown-
Raid Devices : 0
Avail Dev Size : 966020245 (460.63 GiB 494.60 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : active
Device UUID : a61e9d6f:35b53cb1:96105de8:60991128
Update Time : Tue Sep 11 17:05:26 2012
Checksum : 8aa72e70 - correct
Events : 1
Device Role : spare
Array State : ('A' == active, '.' == missing)
sudo mdadm --检查 /dev/sdc6
/dev/sdc6:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : a3945c40:73237cd6:3d61998e:8f773d03
Name : pieciodysk:5
Creation Time : Sun Sep 12 19:36:39 2010
Raid Level : -unknown-
Raid Devices : 0
Avail Dev Size : 966020245 (460.63 GiB 494.60 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : active
Device UUID : 2006abf7:13538568:e5cf2d58:2961a894
Update Time : Tue Sep 11 17:05:26 2012
Checksum : a6653ae8 - correct
Events : 1
Device Role : spare
Array State : ('A' == active, '.' == missing)
sudo mdadm --检查 /dev/sdd6
/dev/sdd6:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : a3945c40:73237cd6:3d61998e:8f773d03
Name : pieciodysk:5
Creation Time : Sun Sep 12 19:36:39 2010
Raid Level : -unknown-
Raid Devices : 0
Avail Dev Size : 966020245 (460.63 GiB 494.60 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : active
Device UUID : 1cf3988f:5259d109:9a8cd419:db31b135
Update Time : Tue Sep 11 17:05:26 2012
Checksum : 424ebb86 - correct
Events : 1
Device Role : spare
Array State : ('A' == active, '.' == missing)
sudo mdadm --检查 /dev/sde6
/dev/sde6:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : a3945c40:73237cd6:3d61998e:8f773d03
Name : pieciodysk:5
Creation Time : Sun Sep 12 19:36:39 2010
Raid Level : raid5
Raid Devices : 5
Avail Dev Size : 966020245 (460.63 GiB 494.60 GB)
Array Size : 3864080896 (1842.54 GiB 1978.41 GB)
Used Dev Size : 966020224 (460.63 GiB 494.60 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : clean
Device UUID : a496841f:489b48dc:e330989a:5991ff4f
Internal Bitmap : 2 sectors from superblock
Update Time : Mon Sep 10 08:31:33 2012
Checksum : 3fd62187 - correct
Events : 66542
Layout : left-symmetric
Chunk Size : 64K
Device Role : Active device 3
Array State : AAAAA ('A' == active, '.' == missing)
sudo mdadm --检查 /dev/sdf6
/dev/sdf6:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : a3945c40:73237cd6:3d61998e:8f773d03
Name : pieciodysk:5
Creation Time : Sun Sep 12 19:36:39 2010
Raid Level : -unknown-
Raid Devices : 0
Avail Dev Size : 966020245 (460.63 GiB 494.60 GB)
Data Offset : 272 sectors
Super Offset : 8 sectors
State : active
Device UUID : 36e0774e:6d6fbde9:d979fbe2:9d91b3ba
Update Time : Tue Sep 11 17:05:26 2012
Checksum : 2f430bc0 - correct
Events : 1
Device Role : spare
Array State : ('A' == active, '.' == missing)
答案1
该问题源于两个事件的结合:
- Ubuntu 安装程序 mini-cd 使用的内核中已知错误,它有效地清除了 raid 成员上的超级块(实际上排除了一个,/dev/sde。我猜是因为 Ubuntu 12.04 在启动过程中存在竞争条件,导致某些磁盘无法被 mdadm 看到 - 请参阅此链接)。
- Ubuntu 12.04 内核使用的另一个内核错误(可能会影响其他内核)会在升级后有效地重置 raid 成员上的超级块。
解决方案:
- 从系统正常运行时获取的系统日志中恢复团队成员的正确顺序(或者,只要团队恢复,就准备在以下步骤中重新排列顺序)
mdadm -C /dev/md5 -e 1.2 -l 5 -n 5 /dev/sd{b,f,c,e,d}6 --assume-clean --uuid=a3945c40:73237cd6:3d61998e:8f773d03
从 Ubuntu 10.04(不是较新版本)Live CD 以 root身份发出mdadm -C /dev/md6 -e 1.2 -l 6 -n 5 /dev/sd{b,f,c,e,d}5 --assume-clean --uuid=2a8fd2df:3ad53552:e8b80ecf:a46d93a2
。(当然,成员设备的名称、UUID、RAID 设备数量等在您的设置中会有所不同。)- 如果突袭内容有效 - 那么我们就完成了。不再需要使用过时的 10.04。
有关详细信息,请参阅此服务器故障问题:要重新创建 md 设备并将其有效负载从备用存储上的 0x22000 位置开始,mdadm 需要使用哪些参数?