iAdd root dir option - dedup - deduplicating backup program Err bitreich.org 70 hgit clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ URL:git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ bitreich.org 70 1Log /scm/dedup/log.gph bitreich.org 70 1Files /scm/dedup/files.gph bitreich.org 70 1Refs /scm/dedup/refs.gph bitreich.org 70 1Tags /scm/dedup/tag bitreich.org 70 1README /scm/dedup/file/README.gph bitreich.org 70 1LICENSE /scm/dedup/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 367928d1742c6f7b12720e6c60a9292e6b708c7c /scm/dedup/commit/367928d1742c6f7b12720e6c60a9292e6b708c7c.gph bitreich.org 70 1parent 34990ad2e3066a5fd23cebc22b997dff63ac272a /scm/dedup/commit/34990ad2e3066a5fd23cebc22b997dff63ac272a.gph bitreich.org 70 hAuthor: sin URL:mailto:sin@2f30.org bitreich.org 70 iDate: Wed, 21 Mar 2018 16:08:11 +0000 Err bitreich.org 70 i Err bitreich.org 70 iAdd root dir option Err bitreich.org 70 i Err bitreich.org 70 iThanks lostd! Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M README | 18 +++++++++--------- Err bitreich.org 70 i M dedup.c | 12 ++++++++++-- Err bitreich.org 70 i Err bitreich.org 70 i2 files changed, 19 insertions(+), 11 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/README b/README /scm/dedup/file/README.gph bitreich.org 70 i@@ -4,29 +4,29 @@ used in a pipeline with tar/gpg etc. Err bitreich.org 70 i dedup only handles a single file at a time, so using tar is advised. Err bitreich.org 70 i For example, to dedup a tar file you can invoke dedup as follows: Err bitreich.org 70 i Err bitreich.org 70 i- tar cf - ~/bak | dedup Err bitreich.org 70 i+ tar cf - ~/bak | dedup -r ~/bak-dedup Err bitreich.org 70 i Err bitreich.org 70 i-This will create .{cache,index,store} files in the current directory. Err bitreich.org 70 i-The store file contains all the unique blocks. The index file Err bitreich.org 70 i-contains all the revisions of files that have been deduplicated. Each Err bitreich.org 70 i-revision is identified by its SHA256 hash. The cache file is only Err bitreich.org 70 i-used to speed up block comparison. Err bitreich.org 70 i+This will create .{cache,index,store} files in the ~/bak-dedup Err bitreich.org 70 i+directory. The store file contains all the unique blocks. The index Err bitreich.org 70 i+file contains all the revisions of files that have been deduplicated. Err bitreich.org 70 i+Each revision is identified by its SHA256 hash. The cache file is Err bitreich.org 70 i+only used to speed up block comparison. Err bitreich.org 70 i Err bitreich.org 70 i To list all known revisions run: Err bitreich.org 70 i Err bitreich.org 70 i- dedup -l Err bitreich.org 70 i+ dedup -r ~/bak-dedup -l Err bitreich.org 70 i Err bitreich.org 70 i You will get a list of hashes. Each hash corresponds to a single file Err bitreich.org 70 i (in this case, a tar archive). Err bitreich.org 70 i Err bitreich.org 70 i To extract a file from the deduplicated store run: Err bitreich.org 70 i Err bitreich.org 70 i- dedup -e > bak.tar Err bitreich.org 70 i+ dedup -r ~/bak-dedup -e > bak.tar Err bitreich.org 70 i Err bitreich.org 70 i You can mix dedup with other programs like gpg(1). For example to Err bitreich.org 70 i perform a remote backup you can use the following command: Err bitreich.org 70 i Err bitreich.org 70 i- tar cf - ~/bak | gpg -c | ssh user@host dedup Err bitreich.org 70 i+ tar cf - ~/bak | gpg -c | ssh user@host dedup -r ~/bak-dedup Err bitreich.org 70 i Err bitreich.org 70 i Cheers, Err bitreich.org 70 i sin Err bitreich.org 70 1diff --git a/dedup.c b/dedup.c /scm/dedup/file/dedup.c.gph bitreich.org 70 i@@ -519,14 +519,14 @@ term(void) Err bitreich.org 70 i void Err bitreich.org 70 i usage(void) Err bitreich.org 70 i { Err bitreich.org 70 i- fprintf(stderr, "usage: %s [-clv] [-e id] [file]\n", argv0); Err bitreich.org 70 i+ fprintf(stderr, "usage: %s [-clv] [-e id] [-r root] [file]\n", argv0); Err bitreich.org 70 i exit(1); Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i int Err bitreich.org 70 i main(int argc, char *argv[]) Err bitreich.org 70 i { Err bitreich.org 70 i- char *id = NULL; Err bitreich.org 70 i+ char *id = NULL, *root = NULL; Err bitreich.org 70 i int fd = -1, lflag = 0, cflag = 0; Err bitreich.org 70 i Err bitreich.org 70 i ARGBEGIN { Err bitreich.org 70 i@@ -539,6 +539,9 @@ main(int argc, char *argv[]) Err bitreich.org 70 i case 'l': Err bitreich.org 70 i lflag = 1; Err bitreich.org 70 i break; Err bitreich.org 70 i+ case 'r': Err bitreich.org 70 i+ root = EARGF(usage()); Err bitreich.org 70 i+ break; Err bitreich.org 70 i case 'v': Err bitreich.org 70 i verbose = 1; Err bitreich.org 70 i break; Err bitreich.org 70 i@@ -549,6 +552,11 @@ main(int argc, char *argv[]) Err bitreich.org 70 i if (argc > 1) Err bitreich.org 70 i usage(); Err bitreich.org 70 i Err bitreich.org 70 i+ if (root != NULL) { Err bitreich.org 70 i+ mkdir(root, 0700); Err bitreich.org 70 i+ chdir(root); Err bitreich.org 70 i+ } Err bitreich.org 70 i+ Err bitreich.org 70 i init(); Err bitreich.org 70 i Err bitreich.org 70 i if (cflag) { Err bitreich.org 70 .