![md0:检测到容量从 0 变为...... md0:未知分区表但系统启动](https://linux22.com/image/978475/md0%EF%BC%9A%E6%A3%80%E6%B5%8B%E5%88%B0%E5%AE%B9%E9%87%8F%E4%BB%8E%200%20%E5%8F%98%E4%B8%BA......%20md0%EF%BC%9A%E6%9C%AA%E7%9F%A5%E5%88%86%E5%8C%BA%E8%A1%A8%E4%BD%86%E7%B3%BB%E7%BB%9F%E5%90%AF%E5%8A%A8%20.png)
因此,我的服务器运行 Ubuntu 14.04 和 3x1T,配置了软件 RAID,出现了问题。我强制mdadm
只使用两个磁盘安装 RAID,将丢失的磁盘添加回 RAID 阵列,系统重建了 RAID,一切看起来都很好。
现在问题来了。每次服务器启动时,我都会看到这些消息
[ 2.440341] md0: detected capacity change from 0 to 482848079872
[ 2.460418] md0: unknown partition table
它等待几秒钟,然后按应有的方式安装分区,一切正常。
以下是更多信息:
mdadm -D /dev/md0 /dev/md0:
Version : 0.90 Creation Time : Sat Feb 26 10:39:28 2011
Raid Level : raid5
Array Size : 1921873792 (1832.84 GiB 1968.00 GB) Used Dev Size : 960936896 (916.42 GiB 984.00 GB) Raid Devices : 3 Total Devices
: 3 Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Fri Jan 30 19:40:00 2015
State : clean Active Devices : 3 Working Devices : 3 Failed Devices : 0 Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : 91c9bf9f:53a9ecfd:80cbc40e:2f20054f
Events : 0.602824
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
2 8 33 2 active sync /dev/sdc1
fdisk -l
Disk /dev/sda: 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: 0x00072f13
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1921875967 960936960 fd Linux raid
autodetect /dev/sda2 1921875968 1953523711 15823872 82
Linux swap / Solaris
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: 0x000d8a37
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 1921875967 960936960 fd Linux raid
autodetect /dev/sdb2 1921875968 1953523711 15823872 82
Linux swap / Solaris
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: 0x000e4fef
Device Boot Start End Blocks Id System
/dev/sdc1 * 2048 1921875967 960936960 fd Linux raid
autodetect /dev/sdc2 1921875968 1953523711 15823872 82
Linux swap / Solaris
Disk /dev/md0: 1968.0 GB, 1967998763008 bytes 2 heads, 4
sectors/track, 480468448 cylinders, total 3843747584 sectors Units =
sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512
bytes / 512 bytes I/O size (minimum/optimal): 65536 bytes / 131072
bytes Disk identifier: 0x00000000
**Disk /dev/md0 doesn't contain a valid partition table**
为什么会这样?我该如何解决?
答案1
为什么?单个磁盘(可能)没有问题,但是 RAID 超级块很可能由于软件/硬件组合故障而损坏。
该怎么办?
- 备份一切!
安装 smartmontools 并对所有驱动器进行全面诊断
sudo apt-get install smartmontools sudo smartctl --test=long /dev/sda sudo smartctl --test=short /dev/sdb sudo smartctl --test=short /dev/sdc
等到测试完成,然后:
sudo smartctl --all /dev/sda sudo smartctl --all /dev/sdb sudo smartctl --all /dev/sdc
解释结果并查看是否有任何驱动器需要更换(如果不清楚,请发表评论,以及我有没有提过要备份?)
寻找坏块:
badblocks -nsv -o /dev/USB-Stick/BadBlocks.sda /dev/sda badblocks -nsv -o /dev/USB-Stick/BadBlocks.sdb /dev/sdc badblocks -nsv -o /dev/USB-Stick/BadBlocks.sdc /dev/sdc
如果发现坏块,则必须将它们合并为 1 个文件(
badblocks.all
。我是不是忘了提到备份?)并传递给所有驱动器:mkfs.ext4 -l /dev/USB-Stick/BadBlocks.all /dev/sda mkfs.ext4 -l /dev/USB-Stick/BadBlocks.all /dev/sdb mkfs.ext4 -l /dev/USB-Stick/BadBlocks.all /dev/sdc
和重新创建您的设备:
mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sda /dev/sdb /dev/sdc
恢复备份
笔记:
- 我绝对不会
mdadm --detail --scan
事先做,因为你会复制错误。 - 如果这是真的时间紧迫,您能如果 3 的结果非常好,就取消 4 和 5,但我不会!
- 如果时间紧迫,你能如果 3 和 4 的结果非常好,那么就取消 5,但我不会!
- 如果您有预算,请放弃软件 RAID5 并购买硬件 RAID5(300-500 美元)
- 如果你有预算,可以再添加 2 个磁盘并升级到 RAID6
- 如果你有整个周末的时间来做这件事,那就
-wsv
做-nsv