borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
10.95k stars 740 forks source link

feature request: update/append "command line" metatag #3615

Open DrupaListo-com opened 6 years ago

DrupaListo-com commented 6 years ago

If one creates a normal archive, one writes "Command line: /usr/bin/borg create --compression lz4 .... REPO::ARCHIVE path1 path2" in the metadata . If we use borg recreate afterwards, the initiall "command line" is not updated and no new one is appended or some NOTE left.

My proposal is that we add a command line switch to borg recreate - to update the command line rewriting history if we wish so - for example:

initial command line: Command line: /usr/bin/borg create --compression lz4 --show-rc --numeric-owner --one-file-system REPO::ARCHIVE /path

AFTER we do: borg recreate REPO --recompress --compression "zstd,10" --rewrite-command-line

we could have the command line be like: Command line: /usr/bin/borg create --compression zstd,10 --show-rc --numeric-owner --one-file-system REPO::ARCHIVE /path

we could have an alternative switch - not rewrite but --append-to-command-line - so in the end we keep all recreate's command lines...

Same thing could be achieved with recreate's --comment option. Or depending if that's what we want we could create a new archive with the --target option.

I want to start a discussion about this. Seems simple and complex at the same time. Simple because in the end it's all about record keeping of some text strings. Complex because there are 5 ways to do it.

ThomasWaldmann commented 6 years ago

I remember that topic was discussed back then, but it somehow was not considered necessary/important.

DrupaListo-com commented 6 years ago

maybe you left it to the --comment option so whoever does the recreate should use --comment to write a record/log of the recreate... ?

Follow up question: does a recreate change the hdd space usage stats that borg info shows? like: Original size Compressed size Deduplicated size for this/all archives?

ThomasWaldmann commented 6 years ago

borg info is dynamically computed, so yes (if the recreate changed space usage at all).

DrupaListo-com commented 6 years ago

yup, I just did some experiments and after a recreate that deleted some files AND recompressed - the size stats indeed changed. If it's dynamically computed - then even a recompress only would change the stats - nice - this way the disk usage stats will not be misleading after a recreate!

DrupaListo-com commented 6 years ago

without putting much energy into this topic I'd propose to simpply add 1-2 lines in the borg recrteate docs, like: "NOTE: If you recreate an archive the original "command line" metadata will not be changed. It is a good idea to use for example borg recreate repo::archive --recompress --compression zstd,10 --comment 'recreate: --recompress --compression zstd,10' " ... At least we can remind DOCS readers that are looking for recreate examples to use the --comment option. Good enough for now?

ThomasWaldmann commented 6 years ago

Yes, a short note for recreate is ok, but just mention --comment without example. For multiple recreate ops on same archive, this gets a bit tricky.

DrupaListo-com commented 6 years ago

NOTE: several recreate invocations with --comment don't append but just overwrite the comment field - worth mentioning in docs too. @ThomasWaldmann - I agree with your last remarks.