linux – 尝试使用dd测试ZFS文件系统的损坏失败
作者:互联网
我正在尝试在最近安装的ZFS的系统上测试错误检测和恢复.我故意用dd覆盖其中一个磁盘的启动,但不能强制检测到任何错误.
我可以不用dd这样做吗?或者我只是没有点击任何数据?
我创建了镜像zfs池并将一些数据复制到它:
$zpool status
pool: zfspool
state: ONLINE
scan: scrub repaired 0 in 0h6m with 0 errors on Sun Dec 1 11:53:12 2013
config:
NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-WDC_WD10EFRX-68JCSN0_WD-WCC1U4257356 ONLINE 0 0 0
ata-WDC_WD10EFRX-68JCSN0_WD-WCC1U4299344 ONLINE 0 0 0
errors: No known data errors
然后我尝试破坏其中一个磁盘:
$dd of=/dev/sdb if=/dev/zero bs=512 count=10000
10000+0 records in
10000+0 records out
5120000 bytes (5.1 MB) copied, 0.103375 s, 49.5 MB/s
并强制读取所有数据:
$diff -qr /home/archive/ /zfspool/archive/
我原本以为这应该在其中一个驱动器上发现损坏,将其标记为无效并将池状态设置为降级但是:
$zpool status
pool: zfspool
state: ONLINE
scan: scrub repaired 0 in 0h6m with 0 errors on Sun Dec 1 11:53:12 2013
config:
NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-WDC_WD10EFRX-68JCSN0_WD-WCC1U4257356 ONLINE 0 0 0
ata-WDC_WD10EFRX-68JCSN0_WD-WCC1U4299344 ONLINE 0 0 0
errors: No known data errors
好吧,让我们擦洗测试一下:
$zpool scrub zfspool
$zpool status
pool: zfspool
state: ONLINE
scan: scrub repaired 0 in 0h6m with 0 errors on Sun Dec 1 12:46:34 2013
config:
NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-WDC_WD10EFRX-68JCSN0_WD-WCC1U4257356 ONLINE 0 0 0
ata-WDC_WD10EFRX-68JCSN0_WD-WCC1U4299344 ONLINE 0 0 0
errors: No known data errors
@ rickhg12hs要求提供的其他信息:
$fdisk -l /dev/sda
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
256 heads, 63 sectors/track, 121126 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 1 121127 976762583+ ee GPT
Partition 1 does not start on physical sector boundary.
[17:37:26][root@zserver2:~]$fdisk -l /dev/sdb
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
[17:38:11][root@zserver2:~]$mount
...
zfspool on /zfspool type zfs (rw,xattr)
zfspool/archive on /zfspool/archive type zfs (rw,xattr)
解决方法:
检测到错误并使用清理程序修复.
在此之前,您没有尝试任何写入,只是读取所有内容都在ARC上(即在RAM上的缓存中)并且磁盘损坏仍然未被检测到.
我忽略了“0错误”.以下是有关可能发生的事情的更正说明:
你用零填充了磁盘开头的~5 MB.
>前3.5 MB是无害的,ZFS保留非ZFS内容的区域,所以从不在那里读或写任何内容.
>下一个.5 MB覆盖了两个vdev标签(四个)
>接下来的1 MB写入可能未包含任何数据或元数据的区域.
vdev标签损坏由于其高冗余(其中仍有六个是健康的)而被忽视,并且标签被原子覆盖的事实无论如何.
标签:linux,dd,zfs 来源: https://codeday.me/bug/20190813/1648998.html