raid5 如何 强制添加已经 remove 了硬盘分区

2021-12-25 22:27:16 +08:00
 huangya
本来是 4 块硬盘组成了 raid5 ,由于某种原因,就移掉了一块硬盘,当然我对整个阵列中的内容进行了备份。
现在突然 3 块硬盘中的一个出现问题,显示被 remove 了。群晖系统提示整个阵列已经损坏,我看了一下
smart 信息,比较正常。但出现了一些 IO 错误。所以把 NAS 拆开重新插了插,现在似乎没有 IO 错误了。我尝试
这用命令想把这个硬盘中的 raid5 分区添加回去,看试试能不能修好。但出现下面的错误。有办法拯救一下吗?
当然我也可以重建,然后从备份中恢复。但有点麻烦,另外自己也想学习折腾一下 raid 。所以发帖请教一下 V 友。

mynas> mdadm /dev/md2 -a /dev/sde3
mdadm: add new device failed for /dev/sde3 as 5: Invalid argument

mynas> mdadm -D /dev/md2
/dev/md2:
Version : 1.2
Creation Time : Fri Sep 4 12:08:49 2015
Raid Level : raid5
Array Size : 5846077248 (5575.25 GiB 5986.38 GB)
Used Dev Size : 1948692416 (1858.42 GiB 1995.46 GB)
Raid Devices : 4
Total Devices : 2
Persistence : Superblock is persistent

Update Time : Sat Dec 25 21:57:32 2021
State : clean, FAILED
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

Layout : left-symmetric
Chunk Size : 64K

Name : mynas:2 (local to host mynas)
UUID : 3e96ec15:11f387df:c455067a:79012a56
Events : 559338

Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 3 1 active sync /dev/sda3
4 8 83 2 active sync /dev/sdf3
3 0 0 3 removed
1531 次点击
所在节点    NAS
6 条回复
greenskinmonster
2021-12-25 22:51:13 +08:00
你的命令似乎少了个参数

mdadm --manage --help / man mdadm 看看 --re-add 这个操作的说明。

mdadm --manage /dev/md2 --re-add /dev/sde3 这个可以试试看。
huangya
2021-12-25 23:10:29 +08:00
@greenskinmonster
mynas> mdadm --manage /dev/md2 --re-add /dev/sde3
mdadm: --re-add for /dev/sde3 to /dev/md2 is not possible

如果 mdadm --manage --help ,没有看到 re-add 这个 option ,但在我的 ubuntu 18.04 是有的,不知道是否是因为这个 NAS 系统比较老的原因,我还在用 5.2 ,因为一直用着很稳定,加上黑裙,所以不想升级。
mynas> mdadm --manage --help
Usage: mdadm arraydevice options component devices...

This usage is for managing the component devices within an array.
The --manage option is not needed and is assumed if the first argument
is a device name or a management option.
The first device listed will be taken to be an md array device, and
subsequent devices are (potential) components of that array.

Options that are valid with management mode are:
--add -a : hotadd subsequent devices to the array
--remove -r : remove subsequent devices, which must not be active
--fail -f : mark subsequent devices a faulty
--set-faulty : same as --fail
--run -R : start a partially built array
--stop -S : deactivate array, releasing all resources
--readonly -o : mark array as readonly
--readwrite -w : mark array as readwrite
huangya
2021-12-25 23:13:49 +08:00
@huangya 不知道是否要搬到 PC 上用 re-add 看看。或者找一个支持 re-add option 的 mdadm (内核应该是支持这个操作的)
geniussoft
2021-12-25 23:59:10 +08:00
1. 是黑群吧。别看群晖硬件抠门,可靠性其实还挺不错。

2. 如果是在线状态下,一块硬盘掉了,不同盘间的数据同步性很可能已经被破坏。
虽然绝大多数地址上的数据都没问题,有问题的数据也未必是有意义的数据,但是毕竟是已经不可信了。

这种情况下,已经无法信任这个阵列了。
必须要重新建立阵列,才能安全。

3. 对于对数据比较重视的用户,除了冷备份或者云备份,本地还是建议白群+RAID6 比较靠谱。
现在处理器性能好了,RAID6 性能也是很棒的,甚至比 RAID10 在大文件读写都更好。
Goldilocks
2021-12-26 03:13:12 +08:00
"Raid Devices : 4" 说明你之前并没有正确的移掉第一块盘。你的总盘数依然是 4 ,然后你坏了两块。凉凉了。
huangya
2021-12-26 10:04:25 +08:00
@geniussoft 是黑裙,但是这个问题纯粹是硬盘的问题,现在这块出问题的硬盘已经用了 10 年了。我有备份,所以也不是特别在乎它,当初的想法是能用多久就用多久

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/824440

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX