Kopia retention setup policy

Global policy

root@jp4:~# kopia policy show --global
Policy for (global):

Retention:
  Annual snapshots:    3           (defined for this target)
  Monthly snapshots:  24           (defined for this target)
  Weekly snapshots:    4           (defined for this target)
  Daily snapshots:     7           (defined for this target)
  Hourly snapshots:   48           (defined for this target)
  Latest snapshots:   10           (defined for this target)

Files policy:
  Ignore cache directories:        true       (defined for this target)
  No ignore rules.
  Read ignore rules from files:               (defined for this target)
    .kopiaignore
  Scan one filesystem only:       false       (defined for this target)

Error handling policy:
  Ignore file read errors:       false       (defined for this target)
  Ignore directory read errors:  false       (defined for this target)
  Ignore unknown types:           true       (defined for this target)

Scheduling policy:
  Scheduled snapshots:
    None
  Manual snapshot:           false   (defined for this target)

Compression disabled.

No actions defined.

Logging details (0-none, 10-maximum):
  Directory snapshotted:      5       (defined for this target)
  Directory ignored:          5       (defined for this target)
  Entry snapshotted:          0       (defined for this target)
  Entry ignored:              5       (defined for this target)
  Entry cache hit             0       (defined for this target)
  Entry cache miss            0       (defined for this target)
root@jp4:~# kopia policy show --global

Set customize snapshot

root@jp4:~# kopia policy set --keep-annual 0 --keep-daily 2 --keep-hourly 2 --keep-latest 3 --keep-monthly 1 --keep-weekly 1 --global
Setting policy for (global)
 - setting "number of annual backups to keep" to 0.
 - setting "number of monthly backups to keep" to 0.
 - setting "number of weekly backups to keep" to 1.
 - setting "number of daily backups to keep" to 2.
 - setting "number of hourly backups to keep" to 5.
 - setting "number of latest backups to keep" to 3.
Running quick maintenance...
Previous content rewrite has not been finalized yet, waiting until the next blob deletion.
Looking for unreferenced blobs...
Deleted total 2 unreferenced blobs (5.1 MB)
Compacting indexes...
Cleaned up 2 logs.
Finished quick maintenance.

Set Kopia maintenance

# Check maintance owner info

kopia maintenance info

# Run quick 
kopia maintenance run
kopia maintenance run --full

root@jp4:~# kopia maintenance run --full
Running full maintenance...
Looking for active contents...
  Processed 2799 contents, discovered 15390...
  Processed 9382 contents, discovered 33912...
  Processed 16248 contents, discovered 57308...
  Processed 25401 contents, discovered 71448...
  Processed 50589 contents, discovered 75249...
  Processed 62010 contents, discovered 101556...
  Processed 67031 contents, discovered 111762...
  Processed 71024 contents, discovered 118839...
  Processed 79872 contents, discovered 125326...
  Processed 101969 contents, discovered 135426...
  Processed 109440 contents, discovered 142705...
  Processed 119450 contents, discovered 147255...
  Processed 129070 contents, discovered 154269...
  Processed 140687 contents, discovered 162493...
  Processed 150274 contents, discovered 168578...
  Processed 166256 contents, discovered 179104...
  Processed 175941 contents, discovered 184737...
  Processed 190814 contents, discovered 194580...
  Processed 198198 contents, discovered 198198...
Looking for unreferenced contents...
Rewriting contents from short packs...
Found safe time to drop indexes: 2021-12-29 23:43:53.057333676 +0800 CST
Dropping contents deleted before 2021-12-29 23:43:53.057333676 +0800 CST
Skipping blob deletion because not enough time has passed yet (59m57s left).
Cleaned up 0 logs.
Finished full maintenance.

References

https://kopia.io/docs/advanced/maintenance