laurent22 / rsync-time-backup

Time Machine style backup with rsync.
3.38k stars 446 forks source link

Delete too old backups #138

Open xifi-kif opened 5 years ago

xifi-kif commented 5 years ago

Hello, is there an option to automatically delete backups that are too old? For example I want to keep only 1 year and delete elder ones

tyriis commented 5 years ago

I don't get your question, old backups are automatically deleted. In any case you can delete them yourself, as the files are hard linked you will not delete files from your harddisk whenever another backup references them.

xifi-kif commented 5 years ago

Maybe I didn't explained myself well. If I understood, old backups are deleted, but some are kept (at least one per year?) until no free space is aviable anymore. Is there an option to set, for example, to keep only until 365 days are passed?

tyriis commented 5 years ago

I don't get the benefit, but all backups are labeled by date so you can just build a cron script to remove your unwanted backups.

To be honest if you don't have deleted or moved a large amount of files durring the last year you will not have much new free space after deleting an old backup.

xifi-kif commented 5 years ago

My backup is about 300GB on a 2TB drive. Every day 20-30 GB are modified. The backup drive is not only used for this backup, there are also other backups. This way (I won't do the math) I'll run out of space soon or late. So the point is (since everything is automated) I don't want other backups to be blocked because there is not enough space.

The cronjob could work, but how can I delete old backups if they are mainly hardlinks?

If I use for example find, didn't it just delete the file and thus al the hardlinks pointing to it?

for example: find /mnt/backups/ -type f -mtime +365 I think it will delete everything older then 365 days.

An integrated funciont of the script would be very useful imho.

joekerna commented 5 years ago

You should go by the name of the backup directory instead of the mtime