md0:检测到容量从0变为… md0:未知分区表但系统启动

所以我的服务器运行Ubuntu 14.04和配置了软件RAID的3x1T时遇到了问题。 我强制mdadm只用两个磁盘安装RAID,我将丢失的磁盘添加回RAIDarrays,系统重建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** 

为什么要这样做,我该怎么做才能解决它?

为什么? 各个磁盘(可能)很好,但由于软件/硬件组合故障,RAID超级块很可能已损坏。

该怎么办?

  1. 备份一切!
  2. 安装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 
  3. 解释结果并查看是否有任何驱动器需要更换(如果不清楚则留下评论, 我是否提到备份?

  4. 寻找坏块:

     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 
  5. 如果你发现坏块,这些必须合并为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 
  6. 重新创建您的设备

     mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sda /dev/sdb /dev/sdc 
  7. 恢复备份

笔记:

  • 我肯定不会事先做一个mdadm --detail --scan因为你会复制错误。
  • 如果这对时间至关重要,如果3的结果很棒,你可以取消4和5, 但我不会
  • 如果这对时间要求很高,如果3和4的结果很棒,你可以取消5, 但我不会
  • 如果你有预算,摆脱软件RAID5并获得硬件RAID5(300-500 $)
  • 如果您有预算,请再添加2个磁盘并转到RAID6
  • 如果您有整个周末来执行此操作,请执行-wsv而不是-nsv

哦,我不是在开玩笑说备份!