我正在运行 Ubuntu 18.04.3 和 zfs 0.7.5-1ubuntu16.6。我的一个磁盘坏了,我正在更换它。在过去,这个方法很有效,只需确保坏磁盘处于离线状态,然后输入:
sudo zpool replace storage /dev/disk/by-partlabel/<disk> /dev/sdX
当我尝试使用新磁盘执行同样的事情时,出现以下错误:
cannot label 'sdc': failed to detect device partitions on '/dev/sdc1': 19
磁盘上什么都没有,没有其他分区或任何我能找到的东西。还有人遇到过这种情况吗?
$ sudo zpool status
pool: storage
state: DEGRADED
status: One or more devices has been taken offline by the administrator.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Online the device using 'zpool online' or replace the device with
'zpool replace'.
scan: scrub repaired 640K in 16h17m with 0 errors on Sun Aug 11 16:41:23 2019
config:
NAME STATE READ WRITE CKSUM
storage DEGRADED 0 0 0
mirror-0 ONLINE 0 0 0
zfs-f34f6853d16a5978 ONLINE 0 0 0
zfs-f65775a49a6072bd ONLINE 0 0 0
mirror-1 DEGRADED 0 0 0
14133798314445255825 OFFLINE 0 0 0 was /dev/disk/by-partlabel/zfs-2085c68dcdc7bffd
zfs-f0b198c01e3a1f71 ONLINE 0 0 0
errors: No known data errors
$ sudo zpool replace storage /dev/disk/by-partlabel/zfs-2085c68dcdc7bffd /dev/sdc
cannot label 'sdc': failed to detect device partitions on '/dev/sdc1': 19
dmesg
这是我运行 zpool 命令替换设备时的输出:
[18588.042150] GPT:disk_guids don't match.
[18588.042153] GPT:partition_entry_array_crc32 values don't match: 0x96474c8a != 0xab54d286
[18588.042153] GPT: Use GNU Parted to correct GPT errors.
[18588.042163] sdc: sdc1 sdc9
[18588.042191] sdc: p1 start 2048+15628034048 is not zone aligned
[18588.042192] sdc: p9 start 15628036096+16384 is not zone aligned
[18588.535438] sdc: sdc1 sdc9
[18588.535481] sdc: p1 start 2048+15628034048 is not zone aligned
[18588.535483] sdc: p9 start 15628036096+16384 is not zone aligned
udevadm monitor
以下是运行 zpool replace 命令时的输出:
$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[18157.755988] add /kernel/slab/:0000016/cgroup/kmalloc-16(115:user.slice) (cgroup)
UDEV [18157.757240] add /kernel/slab/:0000016/cgroup/kmalloc-16(115:user.slice) (cgroup)
KERNEL[18159.954619] change /devices/pci0000:00/0000:00:01.3/0000:03:00.1/ata5/host4/target4:0:0/4:0:0:0/block/sdc (block)
KERNEL[18159.955467] change /devices/pci0000:00/0000:00:01.3/0000:03:00.1/ata5/host4/target4:0:0/4:0:0:0/block/sdc (block)
KERNEL[18160.550473] change /devices/pci0000:00/0000:00:01.3/0000:03:00.1/ata5/host4/target4:0:0/4:0:0:0/block/sdc (block)
UDEV [18160.552780] change /devices/pci0000:00/0000:00:01.3/0000:03:00.1/ata5/host4/target4:0:0/4:0:0:0/block/sdc (block)
UDEV [18160.665757] change /devices/pci0000:00/0000:00:01.3/0000:03:00.1/ata5/host4/target4:0:0/4:0:0:0/block/sdc (block)
UDEV [18160.685367] change /devices/pci0000:00/0000:00:01.3/0000:03:00.1/ata5/host4/target4:0:0/4:0:0:0/block/sdc (block)
zfs
我注意到的一件事是分区已创建,但运行 zpool replace 命令后文件系统无法读取:
(parted) print
Model: ATA ST8000AS0022-1WL (scsi)
Disk /dev/sdc: 8002GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 8002GB 8002GB zfs-ea8ae52d141f3124
9 8002GB 8002GB 8389kB