Detects bit rotten files on the hard drive to save your precious photo and music collection from slow decay.
Go to the desired directory and simply invoke:
This will start digging through your directory structure recursively
indexing all files found. The index is stored in a
which is a SQLite 3 database.
Next time you run
bitrot it will add new files and update the index
for files with a changed modification date. Most importantly however, it
will report all errors, e.g. files that changed on the hard drive but
still have the same modification date.
All paths stored in
.bitrot.db are relative so it's safe to rescan
a folder after moving it to another drive.
Obviously depends on how fast the underlying drive is. Since bandwidth for checksum calculations is greater than your drive's data transfer rate, even when comparing mobile CPUs vs. SSD drives, the script is single-threaded.
No rigorous performance tests have been done. Scanning a ~1000 files totalling ~4 GB takes 20 seconds on a 2015 Macbook Air (SM0256G SSD). This is with cold disk cache.
Some other tests back from 2013: a typical 5400 RPM laptop hard drive
scanning a 60+ GB music library took around 15 minutes. On an OCZ
Vertex 3 SSD drive
bitrot was able to scan a 100 GB Aperture library
in under 10 minutes. Both tests on HFS+.
If you'd like to contribute some more rigorous benchmarks or any performance improvements, I'm accepting pull requests! :)
- bugfix: one place in the code incorrectly hardcoded UTF-8 as the filesystem encoding
- bugfix: print the path that failed to decode with FSENCODING
- bugfix: when using -q, don't hide warnings about files that can't be statted or read
- bugfix: -s is no longer broken on Python 3
- bugfix: bitrot.db checksum checking messages now obey --quiet
- Python 3 compatibility
- bitrot now keeps track of its own database's bitrot by storing a checksum of .bitrot.db in .bitrot.sha512
- bugfix: now properly uses the filesystem encoding to decode file names for use with the .bitrotdb database. Report and original patch by pallinger.
- bugfix: SHA1 computation now works correctly on Windows; previously opened files in text-mode. This fix will change hashes of files containing some specific bytes like 0x1A.
- when a file changes or is renamed, the timestamp of the last check is updated, too
- bugfix: files that disappeared during the run are now properly ignored
- bugfix: files that are locked or with otherwise denied access are skipped. If they were read before, they will be considered "missing" in the report.
- bugfix: if there are multiple files with the same content in the scanned directory tree, renames are now handled properly for them
- refactored some horrible code to be a little less horrible
- more control over performance with
- bugfix: symbolic links are now properly skipped (or can be followed if
- bugfix: files that cannot be opened are now gracefully skipped
- bugfix: fixed a rare division by zero when run in an empty directory
- bugfix: warn about test mode only in test mode
--testcommand-line argument for testing the state without updating the database on disk (works for testing databases you don't have write access to)
- size of the data read is reported upon finish
- minor performance updates
- renames are now reported as such
- all non-regular files (e.g. symbolic links, pipes, sockets) are now skipped
- progress presented in percentage
--sumcommand-line argument for easy comparison of multiple databases
- fixed regression from 0.2.0 where new files caused a
- if a file is no longer there, its entry is removed from the database
- First published version.