dehydrate-fs is a family of tools for separating out files from disk images for the efficient storage of both.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 1 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # <center>Dehydrate-fs (Beta)</center>
  2. `dehydrate-fs` is a family of tools for separating out files from disk images for the efficient storage of both. The project currently exists as a minimum viable product supporting only the `ext2/3/4` filesystems.
  3. ## Quickstart
  4. ```bash
  5. #Generate the filesystem map
  6. map "$file" mapfile.dat
  7. #Dehydrate & compress the filesystem
  8. dehydrate "$file" mapfile.dat | zip -1 "$file".dhd.zip -
  9. #Rehydrate the filesystem
  10. funzip "$file".dhd.zip | rehydrate mapfile.dat "$file".rhd
  11. #Compare results
  12. cmp "$file" "$file".rhd
  13. ```
  14. ## Installation
  15. The scripts may be ran directly. Please ensure you have `perl` and `e2fsprogs` available.
  16. ## Usage
  17. ### `map FILE [MAPFILE]`
  18. Create a mapping of files in the partition image and extract their contents. If `MAPFILE` is not specified, the output is written to `STDOUT`. Files are placed in `./pool/` and are named with their `sha256sum`.
  19. `map` accepts an environment variable `THRESHOLD` for minimum filesize bytes. It defaults to `1048576`.
  20. ### `dehydrate FILE MAPFILE [OUTPUT]`
  21. Create a copy of `FILE` with zeros written to the locations specified by `MAPFILE`. If `OUTPUT` is not specified, the output is written to `STDOUT`. To prevent terminal corruption, the program will not run if `STDOUT` is a terminal.
  22. It is recommended that you stream the output into a compressed archive as the dehydrated file is the same size as the input. `zip` is recommended, but `xz` performs similarly enough. `gzip` does not appear to be appropriate unless higher-quality compression is desired.
  23. ```bash
  24. dehydrate "$file" "$mapfile" | zip -1 "$file".dhd.zip -
  25. ```
  26. ### `rehydrate MAPFILE [OUTPUT]`
  27. Read from `STDIN`, replacing specified subsections with file data according to `MAPFILE`. `rehydrate` requires that the file contents are available under `./pool/`. If `OUTPUT` is not specified, the output is written to `STDOUT`. To prevent terminal corruption, the program will not run if `STDOUT` is a terminal.
  28. ## FAQ:
  29. #### Why is this necessary when chunk-based deduplicating storage systems exist?
  30. To my knowledge, most chunk-based deduplicating storage systems operate at a very coarse level that isn't suitable for collections of average-sized or fragmented files.
  31. #### What is the danger of dataloss?
  32. The tools are written entirely in bash with very little mind paid to error handling. It is assumed the user will verify data integrity before committing irreversible actions. That said, the pseudo-formats are developed specifically to be as simple as possible. Dehydrated `ext2/3/4` filesystem images are mountable using native tools and the mapfile format is trivial to parse.
  33. #### Why the hell is it programmed entirely in bash?!
  34. Because I could.
  35. #### No seriously, why?
  36. I am not a clever man. Even toy programs for interacting with `ext2/3/4` make my head swim. Too many details, not enough visible intent. I prefer shell scripting for this reason.