Ruby File Validator

This is another weekend ruby hack for a little purpose of mine: In case of the continuesly growing available diskspace I wanted to know if there is any silently corrupted data. That this question is interessting for you, shows some next-generation filesystem features like ZFS (don't know for BTRFS, HammerFS or Tux3) has. Due to the ever-improving data density on harddisks (->Perpendicular Recording) they introduced stronger hashsums over stored blocks. But sadly these filesystems can't be used in every szenario, so I wrote a simple tool, that calculates hashsums from every single file in a directory recursivly and stores them in a meta data directory. Then if you do a check later on, it will recalculate all checksums and compares them with the stored ones. If something goes wrong, e.g. lost or corrupted files it will notice you, but nothing more.

Examples

  1. Z:\logic>ruby commandLineValidator.rb -h
  2. Usage: commandLineValidator [options]
  3. -d, --datadir <data dir> directory in which your data resides
  4. -c, --checkdir <checksum dir> directory in which your checksum should be
  5. -r, --repair synchronizes your metadata checksums

Execution from commandline
  1. ruby commandLineValidator.rb -d z:\pool -c z:\checksums -r >z:\checksum.log

Known Bugs

  • Issues with filename length when using windows
  • Not yet tested under other OS but will be tested under Linux in the near future

Changelog

[6. February 2009]
Release of the first version 0.01

AttachmentSize
ruby_file_validator_0.01.zip2.24 KB