我有一个带有 3 个磁盘的 raidz vdev。Disk0 现在出现故障,我尝试恢复,但无法运行zpool import
。Disk0 仍可运行,但分区表已损坏,我尝试重建。
$ zpool import
pool: epool
id: 15752543265619539307
state: FAULTED
status: One or more devices contains corrupted data.
action: The pool cannot be imported due to damaged devices or data.
The pool may be active on another system, but can be imported using
the '-f' flag.
see: http://zfsonlinux.org/msg/ZFS-8000-5E
config:
epool FAULTED corrupted data
raidz1-0 DEGRADED
ata-WDC_WD30EZRX-00D8PB0_WD-WMC4N1642572-part1 UNAVAIL corrupted data
ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N1KPRKPX-part1 ONLINE
ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N7ZXC1E0-part1 ONLINE
有机会修复这个设置吗?
$ zdb -l /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N1KPRKPX-part1
------------------------------------
LABEL 0
------------------------------------
version: 5000
name: 'epool'
state: 0
txg: 108340
pool_guid: 157525$43265619539307
errata: 0
hostname: 'eiselekd-lnx'
top_guid: 5366409938038884073
guid: 3063814570901399057
vdev_children: 1
vdev_tree:
type: 'raidz'
id: 0
guid: 5366409938038884073
nparity: 1
metaslab_array: 35
metaslab_shift: 36
ashift: 12
asize: 9001706717184
is_log: 0
create_txg: 4
children[0]:
type: 'disk'
id: 0
guid: 9231358437407247535
path: '/dev/disk/by-id/ata-WDC_WD30EZRX-00D8PB0_WD-WMC4N1642572-part1'
whole_disk: 0
create_txg: 4
children[1]:
type: 'disk'
id: 1
guid: 3063814570901399057
path: '/dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N1KPRKPX-part1'
whole_disk: 0
DTL: 136
create_txg: 4
children[2]:/dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N7ZXC1E0-part1
type: 'disk'
id: 2
guid: 10884448206527621454
path: '/dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N7ZXC1E0-part1'
whole_disk: 0
create_txg: 4
features_for_read:
com.delphix:hole_birth
com.delphix:embedded_data
labels = 0 1 2 3
在失败的分区中没有显示标签:
# zdb -l /dev/disk/by-id/ata-WDC_WD30EZRX-00D8PB0_WD-WMC4N1642572-part1
--------------------------------------------
LABEL 0
--------------------------------------------
failed to unpack label 0
--------------------------------------------
LABEL 1
--------------------------------------------
failed to unpack label 1
--------------------------------------------
LABEL 2
--------------------------------------------
failed to unpack label 2
--------------------------------------------
LABEL 3
--------------------------------------------
failed to unpack label 3
然而有 Ueberblocks(在分区的开始和结束处发现神奇的 0cb1ba00):我使用了 zfs_revert-0.1.py(https://gist.github.com/jshoward/5685757) 也查看了 disk0 的 txg 信息,并且 disk0 中似乎有某些内容。
TXG TIME TIMESTAMP BLOCK ADDRESSES
108173 08 Feb 2018 02:24:11 1518053051 [360, 872, 5860494696, 5860495208]
108193 08 Feb 2018 02:25:59 1518053159 [264, 776, 5860494600, 5860495112]
108199 08 Feb 2018 02:26:30 1518053190 [312, 824, 5860494648, 5860495160]
108219 07 Mar 2018 16:44:43 1520437483 [472, 984, 5860494808, 5860495320]
108307 08 Mar 2018 15:58:41 1520521121 [408, 920, 5860494744, 5860495256]
108313 09 Mar 2018 14:25:03 1520601903 [456, 968, 5860494792, 5860495304]
108319 12 Mar 2018 17:33:00 1520872380 [504, 1016, 5860494840, 5860495352]
108325 14 Mar 2018 19:23:31 1521051811 [296, 808, 5860494632, 5860495144]
108331 15 Mar 2018 14:36:25 1521120985 [344, 856, 5860494680, 5860495192]
108337 15 Mar 2018 20:07:58 1521140878 [392, 904, 5860494728, 5860495240]
所以我猜可能是分区改变了分区的起始位置。不确定。我做了dd if=/dev/sda | strings | grep WCC4N1KPRKPX-part1
,但是磁盘标签信息不存在...
是否可以用新磁盘替换 ata-WDC_WD30EZRX-00D8PB0_WD-WMC4N1642572-part1 并重新镀银?http://zfsonlinux.org/msg/ZFS-8000-5Ezfs 导入输出中的链接没有给我希望,但是仍然......
答案1
如果不工作,就没有办法恢复 zfs 池zfs import
。然而,zfs import
这不是一个错误恢复工具,因此一般的策略是备份,而不是依赖zfs
故障保存。我扩展了https://github.com/hiliev/py-zfs-rescue支持 Linux 池:https://github.com/eiselekd/dumpbin-py-zfs-rescue。这样我就能恢复我的磁盘了。
答案2
您的池由单个 raidz1 vdev 组成,它可以承受任何一个组成设备的丢失,并且其中一个设备已“损坏”,因此导入池所需的一切都应该在那里。
我不确定为什么 ZFS 不立即导入您的池,而只是将一个设备标记为 UNAVAIL,但您是否尝试过-f
按照zpool import
输出建议的方式使用?这是我要尝试的第一件事。
一旦导入池,对于zpool offline
有问题的分区来说这应该是一件小事,或者更好的zpool replace
是只需重写数据并重新获得冗余即可。
顺便提一下,我建议不要在 ZFS 中使用分区,除非你真的有充分的理由。只需将整个磁盘(例如/dev/disk/by-id/ata-WDC_WD30EZRX-00D8PB0_WD-WMC4N1642572
)交给 ZFS,让它自行处理分区即可。