How do I refresh the magnetic state on a disks with backups?
Generally you can't really refresh the whole disk without reading/writing all of it. fsck
is unlikely to provide what you need - it works with the file system not the underlying device hence it mostly just scans file system meta data (inodes and other file system structures).
badblocks -n
might be an option to dd if=X of=X
. In any case you probably want to use large blocks to speed things up (for dd
something like bs=16M
, for badblocks
this would read -b 16777216
, or -b $((1<<24))
in reasonable shells). You'll probably also want to use conv=fsync
with dd
.
As for the safety of dd
with the same input and output device - it reads block from input and writes it to output, so it should be safe (I have re-encrypted an encrypted partition like this on several occasions, by creating loop devices with the same underlying device and different passwords and then dd
'ing from one to the other) - at least for some types of physical media: for example with shingled drives it is definitely not obvious to me, that it is 100% failure-proof.