maximum data integrity

Notes that I collect (mostly for myself) on how to get maximum data integrity.

ext4 filesystem

  • enable data journalling:
    mount -o data=journal ... ...
  • enable "barriers":
    mount -o barriers=1 ... ...
  • mount filesystem r/o if any errors are found:
    mount -o errors=remount-ro ... ...
  • enable checksums on meta-data (when creating a filesystem):
    mkfs.ext4 -O metadata_csum,64bit /dev/...

software raid

  • write intent bitmaps:
    mdadm -G /dev/md0 -binternal external bitmap::
    --bitmap=/var/my_bitmap.bin: create an external bitmap at the specified path. The path must reside outside the RAID. A bitmap=... parameter must be added to the ARRAY entry in /etc/mdadm/mdadm.conf, and the --bitmap=... parameter must be passed if you are assembling the RAID from the command line.
  • scrub the software raids regularly:
    for f in /sys/block/md? ; do echo check > $f/md/sync_action done
  • configure mdadm notification e-mail address!

devices

  • disable on-disk write cache:
    hdparm -W 0 /dev/...
  • enable s.m.a.r.t.
    apt-get install smartmontools
    Don't forget to configure! e.g. add the following to /etc/smartd.conf:
    /dev/sda -H -C 0 -U 0 -m your@email.address
  • do a disk-check regularly:
    smartctl -t long /dev/sda





feedback