I've always been somewhat paranoid about verifying data backed up to removable media, so after copying stuff to a USB flash drive or portable HDD, I invariably unmount the drive, remount it and diff -q the stored files with the originals.
Years ago I discovered that (at least with the equipment I've got), I was seeing bit errors at something on the order of 1bit/GByte. Somehow (I forget the details) I discovered that the cure is, before writing any data, to do
echo 64 > /sys/block/sda/device/max_sectors
(assuming the media appears as sda of course).
As long as I remember to do that, I've never had any problems.
(I belive the default
max_sectors value is 128).
My questions are:
Is this just me ? I've seen the issue with a variety of flash drives, portable HDDs, motherboards and laptops (but never done an exhaustive test of all combinations to see if I have any which are actually reliable). The media which has been used with windows, and the machines which dual-boot windows, seem to have no similar problems there so it does appear to be linux specific.
What actually causes the issue ? Is non-standards-compliant media, chipsets, cables ?
Is there anything I can configure on my systems (Debian Lenny) which will automatically set the
max_sectors? (Some HAL scriptage or sysctl tweak ? A more global /sys parameter ?). Presumably the default 128 is in the kernel somewhere, but a custom kernel seems a bit drastic.
Thanks for any advice