我的 Linux raid 设置有问题,我希望这里有人可以帮助我再次激活我的 raid,而不会丢失数据。
我有一个 Debian 11 系统,带有一个 raid 阵列(6x1TB 硬盘驱动器,RAID 级别 5)直到今天为止一直处于活动状态,当我又添加了两个1TB HDD 驱动器,并将 raid 级别更改为 6。
注意:为了完成:我的突袭设置一个月前曾是
mdadm --create --verbose /dev/md0 -c 256K --level=5 --raid-devices=6 /dev/sdd /dev/sdc /dev/sdb /dev/sda /dev/sdg /dev/sdf
mkfs.xfs -d su=254k,sw=6 -l version=2,su=256k -s size=4k /dev/md0
mdadm --detail --scan | tee -a /etc/mdadm/mdadm.conf
update-initramfs -u
echo '/dev/md0 /mnt/data ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
今天我做了:
mdadm --add /dev/md0 /dev/sdg /dev/sdh
sudo mdadm --grow /dev/md0 --level=6
这开始了一个成长过程,我可以观察到
watch -n 1 cat /proc/mdstat
md0 是仍然可以全天使用。由于快速文件访问的原因我暂停了生长和插入过程今天发行量约为 50%
echo "frozen" > /sys/block/md0/md/sync_action
文件访问完成后,我重新启动了该过程
echo reshape > /sys/block/md0/md/sync_action
但我在 mdstat 中看到重塑是从头开始的,而不是 50%。五分钟后,我注意到 /dev/dm0 挂载消失了我重新启动了计算机,看看内核是否能正确地重新组装 dm0。也许这是一个问题,因为 dm0 仍在重塑,我不知道..
(注意,由于某种原因,驱动器 sdx 字母顺序在启动后发生了变化,但我没有更改任何设备)
重新启动后 dm0 未重新组装,我无法手动重新组装。当我尝试组装时,总是出现错误
mdadm --assemble --run --force --update=resync /dev/md0 mdadm:
failed to RUN_ARRAY /dev/md0: Input/output error
由于成长过程中的中断,我现在不确定,
如果我的raid设置实际上是raid5或raid6
如果我必须将前 6 个设备连接到 raid 或全部 8 个设备
如何解决所有日志中所述的问题:
mdadm --assemble /dev/md0 /dev/sda /dev/sdb /dev/sdc /dev/sdf /dev/sdi /dev/sdj /dev/sdg/dev/sdh mdadm
--run --force /dev/ MD0
结果:
mdadm: /dev/md0 assembled from 7 drives - need 8 to start (use --run to insist).
mdadm: failed to start
array /dev/md0: Input/output error
我的 dmesg 日志是这样的:
srv11:~# dmesg |tail
[ 3393.321837] sdf:
[ 3415.020629] md/raid:md0: not clean -- starting background reconstruction
[ 3415.020771] md/raid:md0: device sdj operational as raid disk 4
[ 3415.020773] md/raid:md0: device sdi operational as raid disk 5
[ 3415.020774] md/raid:md0: device sdf operational as raid disk 0
[ 3415.020775] md/raid:md0: device sdc operational as raid disk 2
[ 3415.020776] md/raid:md0: device sdb operational as raid disk 1
[ 3415.023097] md: cannot handle concurrent replacement and reshape.
[ 3415.023551] md/raid:md0: failed to run raid set.
[ 3415.023553] md: pers->run() failed ...
我不知道如何处理这个错误“md:无法处理并发替换和重塑。”并且在网络上找不到任何有关 in 的信息。
我已经看到两个驱动器(可能是新的)在 mdadm --examine 中具有“事件:0”,而其他 6 个驱动器都具有“事件:4700”。
谁能给我一个建议如何重新激活这个数组或者至少拯救我的数据从中 ?
我试图强行组装它,但没有成功,似乎突袭缺少有关实际有多少突袭成员以及处于什么状态的信息。首先 mdadm -D /dev/md0 仅显示突袭的 6 名成员,然后我又添加了另外两个,现在它们被视为备用......然而,一个似乎被完全忽略了。
srv11:~# mdadm -v --run --force /dev/md0
mdadm: failed to start array /dev/md0: Input/output error
srv11:~# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Mon Mar 6 18:17:30 2023
Raid Level : raid6
Used Dev Size : 976630272 (931.39 GiB 1000.07 GB)
Raid Devices : 7
Total Devices : 7
Persistence : Superblock is persistent
Update Time : Thu Apr 27 17:36:15 2023
State : active, FAILED, Not Started
Active Devices : 5
Working Devices : 7
Failed Devices : 0
Spare Devices : 2
Layout : left-symmetric-6
Chunk Size : 256K
Consistency Policy : unknown
New Layout : left-symmetric
Name : solidsrv11:0 (local to host solidsrv11)
UUID : 1a87479e:7513dd65:37c61ca1:43184f65
Events : 4700
Number Major Minor RaidDevice State
- 0 0 0 removed
- 0 0 1 removed
- 0 0 2 removed
- 0 0 3 removed
- 0 0 4 removed
- 0 0 5 removed
- 0 0 6 removed
- 8 32 2 sync /dev/sdc
- 8 0 - spare /dev/sda
- 8 144 4 sync /dev/sdj
- 8 80 0 sync /dev/sdf
- 8 16 1 sync /dev/sdb
- 8 128 5 sync /dev/sdi
- 8 96 4 spare rebuilding /dev/sdg
我可以在 syslog 中看到这个错误已经在启动时发生,而 md 组装,我无法弄清楚如何让阵列再次工作。未找到 RaidDevice 3..
启动系统日志片段:
Apr 27 17:37:05 kernel: sde: sde1 sde2 sde3 sde4
Apr 27 17:37:05 kernel: sdj:
Apr 27 17:37:05 kernel: sdg: sdg1 sdg2 sdg3
Apr 27 17:37:05 kernel: sdc:
Apr 27 17:37:05 kernel: sda:
Apr 27 17:37:05 kernel: sdi:
Apr 27 17:37:05 kernel: sdh: sdh1 sdh2 sdh3
Apr 27 17:37:05 kernel: sdf:
Apr 27 17:37:05 kernel: sd 0:0:0:0: [sda] Attached SCSI disk
Apr 27 17:37:05 kernel: sd 3:0:0:0: [sdg] Attached SCSI disk
Apr 27 17:37:05 kernel: sd 6:0:0:0: [sdj] Attached SCSI disk
Apr 27 17:37:05 kernel: sd 0:0:1:0: [sdc] Attached SCSI disk
Apr 27 17:37:05 kernel: sd 0:0:2:0: [sdb] Attached SCSI disk
Apr 27 17:37:05 kernel: sd 2:0:0:0: [sde] Attached SCSI disk
Apr 27 17:37:05 kernel: sd 5:0:0:0: [sdi] Attached SCSI disk
Apr 27 17:37:05 kernel: sd 0:0:3:0: [sdf] Attached SCSI disk
Apr 27 17:37:05 kernel: sd 4:0:0:0: [sdh] Attached SCSI disk
Apr 27 17:37:05 kernel: sd 1:0:0:0: [sdd] Attached SCSI disk
Apr 27 17:37:05 kernel: raid6: sse2x4 gen() 12392 MB/s
Apr 27 17:37:05 kernel: raid6: sse2x4 xor() 7042 MB/s
Apr 27 17:37:05 kernel: raid6: sse2x2 gen() 11331 MB/s
Apr 27 17:37:05 kernel: raid6: sse2x2 xor() 7148 MB/s
Apr 27 17:37:05 kernel: raid6: sse2x1 gen() 10382 MB/s
Apr 27 17:37:05 kernel: raid6: sse2x1 xor() 6645 MB/s
Apr 27 17:37:05 kernel: raid6: using algorithm sse2x4 gen() 12392 MB/s
Apr 27 17:37:05 kernel: raid6: .... xor() 7042 MB/s, rmw enabled
Apr 27 17:37:05 kernel: raid6: using ssse3x2 recovery algorithm
Apr 27 17:37:05 kernel: xor: automatically using best checksumming function avx
Apr 27 17:37:05 kernel: async_tx: api initialized (async)
Apr 27 17:37:05 kernel: md/raid:md0: device sdf operational as raid disk 0
Apr 27 17:37:05 kernel: md/raid:md0: device sdb operational as raid disk 1
Apr 27 17:37:05 kernel: md/raid:md0: device sda operational as raid disk 3
Apr 27 17:37:05 kernel: md/raid:md0: device sdi operational as raid disk 5
Apr 27 17:37:05 kernel: md/raid:md0: device sdc operational as raid disk 2
Apr 27 17:37:05 kernel: md/raid:md0: device sdj operational as raid disk 4
Apr 27 17:37:05 kernel: md: cannot handle concurrent replacement and reshape.
Apr 27 17:37:05 kernel: md/raid:md0: failed to run raid set.
Apr 27 17:37:05 kernel: md: pers->run() failed ...