Difference between revisions of "Backups"

From Briki
Jump to: navigation, search
(Deleting old snapshots)
Line 6: Line 6:
 
== Deleting old snapshots ==
 
== Deleting old snapshots ==
 
Substitute `2021-12` with the month (or months) for which you want to keep a full history
 
Substitute `2021-12` with the month (or months) for which you want to keep a full history
   for snap in `restic snapshots -c | grep maine | sed -e 's!.* !!' | grep -v -- '-01$' | grep -v '2021-12'`
+
   for snap in `restic snapshots -c | grep maine | sed -e 's!.* !!' | grep -v -- '-01$' | grep -v '2019-03-26' | grep -v '2021-12'`
 
   do
 
   do
 
     restic forget --path /var/backup/snapshot/latest --tag $snap --keep-last=-1
 
     restic forget --path /var/backup/snapshot/latest --tag $snap --keep-last=-1

Revision as of 17:04, 31 December 2021

Listing previous snapshots

 sudo -i
 . /etc/restic-init
 restic snapshots

Deleting old snapshots

Substitute `2021-12` with the month (or months) for which you want to keep a full history

 for snap in `restic snapshots -c | grep maine | sed -e 's!.* !!' | grep -v -- '-01$' | grep -v '2019-03-26' | grep -v '2021-12'`
 do
   restic forget --path /var/backup/snapshot/latest --tag $snap --keep-last=-1
 done

Pruning old history

Note: This will also trim the size of the /root/.cache/restic directory

 sudo -i
 . /etc/restic-init
 restic prune