1 unstable release
0.1.0 | Jul 21, 2024 |
---|
#936 in Filesystem
24KB
326 lines
zfs-recompress
Small program to recompress a ZFS directory tree and/or gather metadata on the files within. Basically a multithreaded (and more memory efficient) version of this.
Warning
This software literally rewrites every file in a directory tree. Always make a backup beforehand to prevent data loss!
Usage
For general information on compiling and using Rust programs, see relevant sections of the Rust documentation.
This program will walk through a directory tree and for each file makes a copy (to trigger ZFS compression), verifies its integrity and then overwrites the original file. Naturally, if you have a lot of files, this will take a while!
Optionally, you can also collect some metadata (uid, gid, file size and hash) on all files in the directory tree in an SQLite database while recompressing. This can be very useful to find users with problematic file management habits. To enable metadata collection, specify the --files-db
option with a path to write the SQLite database to.
General usage:
zfs-recompress [OPTIONS] <ROOT_DIR>
Additional options include:
--force
to override any existing database at the location specified via--files-db
--no-recompress
to skip recompression entirely and only collect metadata--skip-compressed
to avoid recompressing files that look like they already are compressed by ZFS (note: use--force-hash
if you still want hashes on these files in the metadata database!)--batch-size
to specifiy how many files at once are assigned to a single thread (you might want to reduce this one if you have very large files to enable better parallelism)--worker-threads
to specify the number of threads running in parallel (strongly depends on IO speeds and how fast your CPU can calculate hashes)
Please check zfs-recompress --help
for a full overview over all usage options.
License
Much like the original, this software is licensed as free software under the GPLv2 license. You can find the details of this license in the LICENSE
file.
Dependencies
~40MB
~660K SLoC