Documenting policy options

Hi,

I am testing this great tool for the first time and I have a couple of doubts/remarks:

  1. Do the options --snapshot-time and --snapshot-interval automatically schedule backup jobs? If so, is there an option to set the time of first run (e.g. schedule first run on Saturday at 00:00 and then every 168h [1w])?
  2. It looks like --compression-min-size only parses int strings, is the size measured in bytes (e.g. 64000=64kB)?
  3. Generally speaking, I think it would be extremely helpful to add a couple of examples to each option in the help message and in the cmd-line reference section of the documentation, especially when there is no default value to use as hint.

Thank you in advance!
Simone

2 Likes

If you’re running

kopia policy set --help

from the command line, while being connected to your kopia repo, you will get a detailed list of options and what they mean. This will also likely show you thi:

–snapshot-interval=SNAPSHOT-INTERVAL …
Interval between snapshots
–snapshot-time=SNAPSHOT-TIME …
Times of day when to take snapshot (HH:mm)

So yes, you should be able to set the schedule up, the way you indicated. However, note that you’ll need to specify both parameters, so something along this line should set you up:

kopia policy set --snapshot-time=9:00 --snapshot-interval=168h < your policy id >

Hi @budy, thanks a lot for your answer.

Actually in the meantime I have found this post, and it looks like those options have no effect without a running server or UI. I believe this is typically something which could be mentioned in the help message.

Concerning my third point, the help messages are already great as they are, but unfortunately I found myself digging in the argument parsing on GitHub because I was missing some essential info like the --compression-min-size unit I mentioned (which btw I confirm is measured in bytes). It would be really helpful to e.g. change the current message (–compression-min-size=COMPRESSION-MIN-SIZE Min size of file to attempt compression for) to something like (–compression-min-size=INT Min size of file to attempt compression for [0 bytes]). Another example is --compression, whose help message is currently –compression=COMPRESSION Compression algorithm: would be nice to add –compression=<pgzip|s2|zstd> Compression algorithm: choose [don’t compress].

Thanks
Simone

Actually, the best for --compression-min-size (and what I tried instinctively before seeing the error message and checking the code) would be to parse human-readable file sizes (64k, 1M, 2GB, etc), but I guess this is for another issue/discussion.

1 Like

Just wanted to pipe in that I had essentially the same questions as OP in regards to --compression-min-size as well as the scheduler, with regards to the presence of any sort of daemon.

The suggestion of human-readable file sizes for compression settings is a good one, and the docs should in some way specify that snapshot policies are to guide the server and UI exclusively.

1 Like