Automatically delete Schnaps Snapshots

Hello community,
as the snapshots are filling up my device quite quickly - I would like to write a script or something to delete old ones (except the ones that I create manually). Like the best would be if I could keep the first Snapshot, the manually created ones and then the last 5 of the automatically created ones - can someone please shed some light on how this could work?

Thanks and have a great day.

settings file is


Thanks - that was obvious :smile:

I would recommend to keep a litle bit more than 5 auto schnapshots. When something goes wrong during autoupdate and Turris team is trying to fix it, there could be more than 5 snapshots and you will lost your latest working snapshot. :wink:

Can you or anyone recommend some best practice?

Iā€™d recommend to create extra snapshot (schnapps) after each significant change of your configuration and export it to external memory (USB/SSD/HDD) and keep it there for possible later use of re-creating your working configurationā€¦ (see documentation for how-to)
Just my 2 cents

1 Like

In case some reader stumbling over this might not know, btrfs snapshots operate in a copy on write fashion, so if two older snapshots reference the same unchanged file this file will not actually be stored twice for the snapshots but only once, and if the file in the current filesystem has not changed from when the snapshots were taken not even a single back-up copy exists. This copy will be automatically created once a process starts changing the file, and as far as I know there will only be a single back-up.
Now if the file changed between the snapshots there will be multiple copiesā€¦

A consequence of this is that it is unintuitive how much ā€œdisk-spaceā€ is recovered from deleting snapshots and how much space deletion of an arbitrary snapshot recoversā€¦ that said keeping all snapshots for ever will not work, but I would make snapshot deletion partially dependent on the amount of free spaceā€¦

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.