Let's say we have a source directory, dir that we are going to backup
into backup with default options and backup--snap with --snap. We
will have in it the files:
- On Day 1
- B
- C
- D
- On Day 2
- A is Added
- B stay the same in Both days
- C is Changed
- D is Deleted and not there anymoreSo, on Day 1:
We set up the source
# mkdir dir; echo bbb >dir/B;echo ccc >dir/C;echo ddd >dir/D
# ls -l dir
total 12
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 C
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 D
We backup normally
# rsync-incr 5 dir backups/dir
# ls -lR backups
backups:
total 8
drwxrwxr-x 2 colas local 4096 Jan 10 23:40 dir
drwxrwxr-x 2 colas local 4096 Jan 10 23:42 dir.past
backups/dir:
total 12
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 C
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 D
backups/dir.past:
total 4
-rw-rw-r-- 1 colas local 17 Jan 10 23:42 LAST_DATE
We backup with --snap
# rsync-incr --snap 5 dir backups--snap/dir
# ls -lR backups--snap
backups--snap:
total 8
drwxrwxr-x 2 colas local 4096 Jan 10 23:40 dir
drwxrwxr-x 3 colas local 4096 Jan 10 23:44 dir.past
backups--snap/dir:
total 12
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 C
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 D
backups--snap/dir.past:
total 8
drwxrwxr-x 2 colas local 4096 Jan 10 23:44 2009-01-10.23h44-0m
-rw-rw-r-- 1 colas local 17 Jan 10 23:44 LAST_DATE
backups--snap/dir.past/2009-01-10.23h44-0m:
total 0 On day 2
We set up the source
# rm dir/D; echo aaa>dir/A; echo CCC>dir/C
# ls -l dir/
total 12
-rw-rw-r-- 1 colas local 4 Jan 10 23:48 A
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B
-rw-rw-r-- 1 colas local 4 Jan 10 23:48 C
We backup normally
# rsync-incr 5 dir backups/dir
# ls -lR backups
backups:
total 8
drwxrwxr-x 2 colas local 4096 Jan 10 23:48 dir
drwxrwxr-x 3 colas local 4096 Jan 10 23:50 dir.past
backups/dir:
total 12
-rw-rw-r-- 1 colas local 4 Jan 10 23:48 A
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 B
-rw-rw-r-- 1 colas local 4 Jan 10 23:48 C
backups/dir.past:
total 8
drwxrwxr-x 2 colas local 4096 Jan 10 23:50 2009-01-10.23h42-1m
-rw-rw-r-- 1 colas local 17 Jan 10 23:50 LAST_DATE
backups/dir.past/2009-01-10.23h42-1m:
total 8
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 C
-rw-rw-r-- 1 colas local 4 Jan 10 23:40 D
There, you can see that the "past" backup dir contains an image of the whole of dir the "day" before. But you see that B has a link count of 2 so is shared between the 2 backup dirs, whereas C is not, the 2 C files have different contents
We backup with --snap
# rsync-incr --snap 5 dir backups/dir
# ls -lR backups--snap/:
total 8
drwxrwxr-x 2 colas local 4096 Jan 10 23:30 dir
drwxrwxr-x 4 colas local 4096 Jan 10 23:30 dir.past
backups--snap/dir:
total 12
-rw-rw-r-- 1 colas local 4 Jan 10 23:30 A
-rw-rw-r-- 2 colas local 4 Jan 10 23:27 B
-rw-rw-r-- 1 colas local 4 Jan 10 23:30 C
backups--snap/dir.past:
total 12
drwxrwxr-x 2 colas local 4096 Jan 10 23:30 2009-01-10.23h30-0m
drwxrwxr-x 2 colas local 4096 Jan 10 23:27 2009-01-10.23h30-1m
-rw-rw-r-- 1 colas local 17 Jan 10 23:30 LAST_DATE
backups--snap/dir.past/2009-01-10.23h30-0m:
total 0
backups--snap/dir.past/2009-01-10.23h30-1m:
total 12
-rw-rw-r-- 2 colas local 4 Jan 10 23:27 B
-rw-rw-r-- 1 colas local 4 Jan 10 23:27 C
-rw-rw-r-- 1 colas local 4 Jan 10 23:27 D
There, you can see that the "past" backup dir contains an image of the whole of dir the "day" before. But you see that B has a link count of 2 so is shared between the 2 backup dirs, whereas C is not, the 2 C files have different contents