The simplest and fastest way would probably be,
dd if=/dev/sda of=/dev/sda bs=256M
dd
reads before writing (of course, or it wouldn't have anything to write), and device position is independent on source and destination.
Also, this assumes that the disk doesn't die on you during the refresh.
I'd run a speed test using the same overall amount of data, but a bs
equal to one third, one half, exactly and twice the size of the hard disk cache. Depending on the hard disk controller's cache allocation strategy you might experience significantly different rewrite times.
So, for example, assuming a 256M cache,
time dd ... bs=80M count=1638
time dd ... bs=128M count=1024
time dd ... bs=256M count=512
time dd ... bs=512M count=256
However, bs
should not exceed one full physical cylinder's worth of data, otherwise the mechanics of the hard disk will be forced to skip one track to read the data beyond the first cylinder, and then skip back to write the same data. You will easily recognize the situation because the hard disk will begin to stridulate. You want it to emit instead a determined "tic. tic. tic.", each cylinder being addressed only once. Determining physical size is difficult due to LBA mapping, and it might even be impossible on newer hard disks due to different cylinder sizes in the various allocation zones (at different distances from the spindle). In such cases, "refreshing" a disk will impart a significant stress on the drive mechanics.
zpool scrub ...
?copies
property to store multiple data copies on a single disk is not recommended.zpool scrub
is run. Periodically running a scrub is just a way of ensuring that all used blocks are regularly read. Detected errors are automatically corrected if there is sufficient redundancy (i.e. a mirror or raidz vdev, or even via the "copies" property). BTW, I say "block" here rather than "file" because ZFS checksums are per-block, not per-file (and a file may have 0, 1, or many blocks) and also because ZFS supports zvols (which are analogous to LVM's logical volumes) as well as filesystem datasets.