![需要重建 mdadm raid5](https://linux22.com/image/117755/%E9%9C%80%E8%A6%81%E9%87%8D%E5%BB%BA%20mdadm%20raid5.png)
我有一个 mITX nas,运行 Arch 和 Raid5 mdadm softraid。上次正确启动
Aug 19 11:30:21 nas kernel: md/raid:md127: device sdc1 operational as raid disk 1
Aug 19 11:30:21 nas kernel: md/raid:md127: device sdd1 operational as raid disk 2
Aug 19 11:30:21 nas kernel: md/raid:md127: device sda1 operational as raid disk 0
Aug 19 11:30:21 nas kernel: md/raid:md127: raid level 5 active with 3 out of 4 devices, algorithm 2
Aug 19 11:30:21 nas kernel: md127: detected capacity change from 0 to 5648992960512
Aug 19 11:30:21 nas systemd[1]: Found device /dev/md127.
Aug 19 11:30:21 nas kernel: EXT4-fs (md127): mounted filesystem with ordered data mode. Opts: (null)
Aug 31 04:07:35 nas kernel: md/raid:md127: read error not correctable (sector 3546939392 on sda1).
Aug 31 04:07:35 nas kernel: md/raid:md127: read error not correctable (sector 3546939400 on sda1).
开始显示错误,视频播放出现问题。显然我的电源连接松动,导致
EXT4-fs (md127): Delayed block allocation failed for inode 159647386 at logical offset 129152 with max blocks 128 with error 117
焊接连接后,无法安装 raid5 /dev/md127。
[user@nas mdadmtests]$ sudo mount -av
/ : ignored
mount: /mnt/raid5: wrong fs type, bad option, bad superblock on /dev/md127, missing codepage or helper program, or other error.
none : ignored
一些信息:驱动器处于备用模式吗?
[user@nas mdadmtests]$ cat /proc/mdstat
Personalities :
md127 : inactive sdd1[3](S) sdc1[1](S) sdf1[4](S) sda1[0](S)
7355461072 blocks super 1.0
unused devices: <none>
检查每个驱动器,注意 /dev/sdf1 上的事件计数较低
/dev/sda1:
Magic : a92b4efc
Version : 1.0
Feature Map : 0x9
Array UUID : a1498410:d13b2b4a:63379f8d:c821173f
Name : fileserver:127
Creation Time : Mon Jan 19 15:35:41 2015
Raid Level : raid5
Raid Devices : 4
Avail Dev Size : 3677730536 (1753.68 GiB 1883.00 GB)
Array Size : 5516594688 (5261.03 GiB 5648.99 GB)
Used Dev Size : 3677729792 (1753.68 GiB 1883.00 GB)
Super Offset : 3677730800 sectors
Unused Space : before=0 sectors, after=992 sectors
State : clean
Device UUID : 0e56183d:0c49cf03:e3429b77:e1f718e7
Internal Bitmap : -16 sectors from superblock
Update Time : Sun Sep 3 02:44:36 2017
Bad Block Log : 512 entries available at offset -8 sectors - bad blocks present.
Checksum : 4ea92cdf - correct
Events : 1931038
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 0
Array State : AAA. ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdc1:
Magic : a92b4efc
Version : 1.0
Feature Map : 0x1
Array UUID : a1498410:d13b2b4a:63379f8d:c821173f
Name : fileserver:127
Creation Time : Mon Jan 19 15:35:41 2015
Raid Level : raid5
Raid Devices : 4
Avail Dev Size : 3677730536 (1753.68 GiB 1883.00 GB)
Array Size : 5516594688 (5261.03 GiB 5648.99 GB)
Used Dev Size : 3677729792 (1753.68 GiB 1883.00 GB)
Super Offset : 3677730800 sectors
Unused Space : before=0 sectors, after=992 sectors
State : clean
Device UUID : 472f7a29:679e1f18:87ee0d4c:88b2a62b
Internal Bitmap : -16 sectors from superblock
Update Time : Sun Sep 3 08:57:12 2017
Bad Block Log : 512 entries available at offset -8 sectors
Checksum : 685d1908 - correct
Events : 1931038
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 1
Array State : .AA. ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdd1:
Magic : a92b4efc
Version : 1.0
Feature Map : 0x1
Array UUID : a1498410:d13b2b4a:63379f8d:c821173f
Name : fileserver:127
Creation Time : Mon Jan 19 15:35:41 2015
Raid Level : raid5
Raid Devices : 4
Avail Dev Size : 3677730536 (1753.68 GiB 1883.00 GB)
Array Size : 5516594688 (5261.03 GiB 5648.99 GB)
Used Dev Size : 3677729792 (1753.68 GiB 1883.00 GB)
Super Offset : 3677730800 sectors
Unused Space : before=0 sectors, after=992 sectors
State : clean
Device UUID : 7d61bcf5:ff6f3213:bb4518c6:d067fadd
Internal Bitmap : -16 sectors from superblock
Update Time : Sun Sep 3 08:57:12 2017
Bad Block Log : 512 entries available at offset -8 sectors
Checksum : 5c102956 - correct
Events : 1931038
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 2
Array State : .AA. ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdf1:
Magic : a92b4efc
Version : 1.0
Feature Map : 0x1
Array UUID : a1498410:d13b2b4a:63379f8d:c821173f
Name : fileserver:127
Creation Time : Mon Jan 19 15:35:41 2015
Raid Level : raid5
Raid Devices : 4
Avail Dev Size : 3677730536 (1753.68 GiB 1883.00 GB)
Array Size : 5516594688 (5261.03 GiB 5648.99 GB)
Used Dev Size : 3677729792 (1753.68 GiB 1883.00 GB)
Super Offset : 3677730800 sectors
Unused Space : before=0 sectors, after=992 sectors
State : clean
Device UUID : 061c45a0:0017e14f:6d0bb9a9:d8beeb91
Internal Bitmap : -16 sectors from superblock
Update Time : Fri Apr 29 12:27:54 2016
Bad Block Log : 512 entries available at offset -8 sectors
Checksum : d831f3b0 - correct
Events : 13259
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 3
Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing
为了轻松区分 4 个驱动器,请检查此图像。 https://i.stack.imgur.com/1OYqb.jpg
我应该使用吗mdadm --assemble -force --scan /dev/md127 /dev/sd[acdf]1
?非常感谢您的帮助。提前致谢!
编辑
所以,仍然不知道在这里做什么。试图重现袭击。
[root@nas ~]# mdadm --create /dev/md127 --metadata 1.2 --level=5 --raid-devices=4 --chunk=512 --layout=left-symmetric /dev/sda1 /dev/sdc1 /dev/sdd1 missing
mdadm: /dev/sda1 appears to contain an ext2fs file system
size=5516594688K mtime=Sat Sep 2 14:22:17 2017
mdadm: /dev/sda1 appears to be part of a raid array:
level=raid5 devices=4 ctime=Mon Jan 19 15:35:41 2015
mdadm: /dev/sdc1 appears to be part of a raid array:
level=raid5 devices=4 ctime=Mon Jan 19 15:35:41 2015
mdadm: /dev/sdd1 appears to be part of a raid array:
level=raid5 devices=4 ctime=Mon Jan 19 15:35:41 2015
Continue creating array? n
mdadm: create aborted.
我很确定我确实创建了 ext4 文件系统,而不是 ext2。
编辑20180429
我决定再试一次。但经过这么长的时间,有些事情发生了变化,老实说我不记得我对突袭做了什么。
也许我只是一起发表一个新帖子。我先补充一下目前的情况。开始了。
[user@nas ~]$ cat /proc/mdstat
Personalities :
md127 : inactive sdb1[1](S) sda1[0](S)
3677730784 blocks super 1.0
unused devices: <none>
对每个驱动器的新检查:
/dev/sda1:
Magic : a92b4efc
Version : 1.0
Feature Map : 0x1
Array UUID : 71da073c:d1928293:6947fa19:92d8a7bd
Name : taknas:127 (local to host taknas)
Creation Time : Sun Dec 10 23:26:56 2017
Raid Level : raid5
Raid Devices : 4
Avail Dev Size : 3677730784 (1753.68 GiB 1883.00 GB)
Array Size : 5516594688 (5261.03 GiB 5648.99 GB)
Used Dev Size : 3677729792 (1753.68 GiB 1883.00 GB)
Super Offset : 3677730800 sectors
Unused Space : before=0 sectors, after=992 sectors
State : clean
Device UUID : ebd3b12c:975c1a0b:4653f1ed:e9788e37
Internal Bitmap : -16 sectors from superblock
Update Time : Mon Dec 18 11:48:12 2017
Bad Block Log : 512 entries available at offset -8 sectors
Checksum : 931a5e9d - correct
Events : 1
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 0
Array State : AA.. ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdb1:
Magic : a92b4efc
Version : 1.0
Feature Map : 0x1
Array UUID : 71da073c:d1928293:6947fa19:92d8a7bd
Name : taknas:127 (local to host taknas)
Creation Time : Sun Dec 10 23:26:56 2017
Raid Level : raid5
Raid Devices : 4
Avail Dev Size : 3677730784 (1753.68 GiB 1883.00 GB)
Array Size : 5516594688 (5261.03 GiB 5648.99 GB)
Used Dev Size : 3677729792 (1753.68 GiB 1883.00 GB)
Super Offset : 3677730800 sectors
Unused Space : before=0 sectors, after=992 sectors
State : clean
Device UUID : e1fdc3d2:b0f117a5:11856184:17db9522
Internal Bitmap : -16 sectors from superblock
Update Time : Mon Dec 18 11:48:12 2017
Bad Block Log : 512 entries available at offset -8 sectors
Checksum : 54a1b1a7 - correct
Events : 1
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 1
Array State : AA.. ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdc1:
Magic : a92b4efc
Version : 1.0
Feature Map : 0x1
Array UUID : a1498410:d13b2b4a:63379f8d:c821173f
Name : fileserver:127
Creation Time : Mon Jan 19 15:35:41 2015
Raid Level : raid5
Raid Devices : 4
Avail Dev Size : 3677730536 (1753.68 GiB 1883.00 GB)
Array Size : 5516594688 (5261.03 GiB 5648.99 GB)
Used Dev Size : 3677729792 (1753.68 GiB 1883.00 GB)
Super Offset : 3677730800 sectors
Unused Space : before=0 sectors, after=992 sectors
State : clean
Device UUID : 472f7a29:679e1f18:87ee0d4c:88b2a62b
Internal Bitmap : -16 sectors from superblock
Update Time : Sun Dec 10 21:09:34 2017
Bad Block Log : 512 entries available at offset -8 sectors
Checksum : 68dd142f - correct
Events : 1934728
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 1
Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
看起来我创建了一个新的 raid,但不包括 sdc1。
我有机会修复我以前的 raid5 并保存其中存储的数据吗?
最初它是用
root# mdadm --create --metadata=1.0 --verbose /dev/md127 --chunk=512 --level=5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1