[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tarsnap --print-stats without the cache?



On Sat, Feb 18, 2017 at 03:39:10PM +0100, Philip Paeps wrote:
> I could presumably set an ACL on the cache directory but I wonder if
> this sort of thing really needs access to the cache.  I know that the
> Tarsnap server doesn't know anything about the individual archives, but
> it surely knows about the total amount of data stored.

The total amount, but not the details.  How can tarsnap decide if it needs to
upload a block of data or not, unless it has a cache?

For the record, you can create a new cache directory with --fsck; this is one
of the ways that you can use a machine key on multiple systems.
http://www.tarsnap.com/multiple-machines.html
It does involve downloading about 0.1% of the total archive size each time
you use it, though, so it's not a particularly recommended method.


Here's an example of trying to avoid the cache.
### I've already backed up this directory:

$ ./tarsnap --dry-run -c .
                                       Total size  Compressed size
All archives                                29 MB           8.5 MB
  (unique data)                             14 MB           4.2 MB
This archive                                14 MB           4.2 MB
New data                                    635 B           1.2 kB

### but without the cachedir, tarsnap doesn't know that:

$ ./tarsnap --dry-run --cachedir foo -c .
Directory foo created for "--cachedir foo"
tarsnap: Not adding cache directory to archive: ./foo
                                       Total size  Compressed size
All archives                                14 MB           4.2 MB
  (unique data)                             14 MB           4.2 MB
This archive                                14 MB           4.2 MB
New data                                    14 MB           4.2 MB

### I can, of course, get tarsnap to "figure out what data is already
### stored on the server"...

$ ./tarsnap --cachedir foo --fsck
Phase 1: Verifying metadata validity
Phase 2: Verifying metadata/metaindex consistency
Phase 3: Reading chunk list
Phase 4: Verifying archive completeness
  Archive 1/1...
Phase 5: Identifying unreferenced chunks
$ ./tarsnap --dry-run --cachedir foo -c .
tarsnap: Not adding cache directory to archive: ./foo
                                       Total size  Compressed size
All archives                                29 MB           8.5 MB
  (unique data)                             14 MB           4.2 MB
This archive                                14 MB           4.2 MB
New data                                    99 kB           5.6 kB

### ... and now it knows that it barely needs to upload anything.


(NB: it's not recommended to back up one's tarsnap cache directory; I was just
a bit sloppy while constructing this example.  That's also why there's more
"New data" for the final example than the first example.)

Cheers,
- Graham