我想用随机字节覆盖一个非常大的硬盘驱动器(18TB),然后检查智能数据是否有重新分配的扇区或其他错误。
由于 badblocks 对单次运行中使用的块数量有一些限制,我尝试了 archlinux wiki 上描述的“cryptsetup 方法”:
https://wiki.archlinux.org/title/Badblocks#Finding_bad_sectors
我在整个驱动器上设置了一个加密的逻辑设备字段,然后使用命令“shred”将零写入打开的字段设备:
cryptsetup open /dev/device eld --type plain --cipher aes-xts-plain64
shred -v -n 0 -z /dev/mapper/eld
Run Code Online (Sandbox Code Playgroud)
它继续打印诸如
shred: /dev/mapper/eld: pass 1/1 (000000)...870MiB/17TiB 0%
shred: /dev/mapper/eld: pass 1/1 (000000)...1.7GiB/17TiB 0%
...
shred: /dev/mapper/eld: pass 1/1 (000000)...4.1TiB/17TiB 24%
Run Code Online (Sandbox Code Playgroud)
但随后它停止在 4.1TiB/17TiB 写入。我已经用 hexdump 验证了这一点,零没有写入到字节地址 0x428249b0000 (4570459340800 ~ 4.156 TiB) 之外:
hexdump -C --skip 0x428249a0000 /dev/mapper/eld | head
428249a0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| …Run Code Online (Sandbox Code Playgroud)