Duplicity creates snapshots, but in the form of compressed archives, not in a form that can be read directly.
There are several ways to create snapshots. Some advanced filesystems such as ZFS and Btrfs have them as a built-in feature, as do some disk layers such as LVM.
On a generic filesystem, a basic technique is to reproduce the directory tree that you want to make a snapshot of, but create hard links to each file instead of copying files. When a file is deleted and replaced by a new version, the snapshot retains the old version. Note that some applications modify files in place; this would modify the snapshot version as well since they are the same file. This is an inherent problem with hard-link-based solutions.
A variant of straight hard linking is to always make a copy when backing up a file, but if a file hasn't changed since the last backup, make a hard link to the earlier backup rather than make a new copy. Unlike the previous approach, this one is suitable for backups since it doesn't risk rewriting history by modifying files in old backups.
Rsync with the --link-dest option and Rsnapshot are the most common tools to make such snapshots. Rsnapshot is a higher-level tool: it uses rsync under the hood, but takes care of calling it with the right arguments, of managing the culling of old backups, etc.
With rsnapshot, you specify how to cull old backups by defining several intervals. The lowest interval is the frequency at which backups are taken, in your case very day. Longer intervals define what backups are retained. For each directive retain INTERVAL N in rsnapshot.conf, when you run rsnapshot INTERVAL, rsnapshot does two things:
- Cull the backup directories so that only
N-1 snapshots remain for INTERVAL.
- For the lowest interval, make a backup; for other intervals, replicate the current image for the previous interval.
For example, to make daily backups and retain the backups from 3, 5 and 10 days ago, and include the following retain lines in your /etc/rsnapshot.conf:
retain daily 2
retain day3 2
retain day5 3
Run rsnapshot daily as a daily cron job. A few minutes before that job, run rsnapshot day3 and rsnapshot day5 every three days; you can approximate it like this:
04 04 5,10,15,20,25,30 * * rsnapshot day5
07 04 3,6,9,12,15,18,21,24,27,30 * * rsnapshot day3
10 04 * * * rsnapshot daily
(You can't have backups from e.g. exactly 3 days ago because you're erasing on day 2 — what you do instead is retain one daily backup in 3.) A more classical retention scheme is weekly and monthly retention as illustrated in the rsnapshot documentation.