Rsync and symlinks at destination dir
by obobskivich from LinuxQuestions.org on (#5A638)
Alright I have a question that I didn't expect to run into (because I imagined this would work differently), so here's some background:
I run rsync to backup a large drive (lets call it /data) to a backup (lets call it /backup), however /backup is a physically smaller drive than /data, so what I did is added another drive (that makes up the capacity difference) and called it /backup2, moved some of the subfolders within the /data structure onto /backup2 from /backup, and symlinked (ln -s) them back. Browsing this either in GUI or CLI everything works - /backup now has enough space and all is well. HOWEVER when I ran rsync with the -n flag (I normally run rsync -arv) just to see that this worked, so rsync -arvn /data /backup, it grabbed all the folders/files that I just moved from /backup to /backup2, and shows them as candidates for putting onto /backup and it looks like it isn't 'following' the symlinks through to /backup2 (in other words, if you 'browse the data' its all there, just linked onto the other device - but rsync doesn't seem to 'see' that).
So - where did I go wrong?
What I want is:
Sync'ing /data to /backup and /backup2 to make up the space, but ideally as a single command like rsync /data /backup instead of having to get into exclusion masks (because I've never had good luck with those consistently working), and letting the symlinks 'fill in' the gap so that /backup2 can make up the size.
Any ideas? I did some googling and what I found was largely people wanting to rsync FROM some location with symlinks (e.g. if /data contained symlinks to some other place like /data2), but not TO some location that relies on symlinks to sort everything out.


I run rsync to backup a large drive (lets call it /data) to a backup (lets call it /backup), however /backup is a physically smaller drive than /data, so what I did is added another drive (that makes up the capacity difference) and called it /backup2, moved some of the subfolders within the /data structure onto /backup2 from /backup, and symlinked (ln -s) them back. Browsing this either in GUI or CLI everything works - /backup now has enough space and all is well. HOWEVER when I ran rsync with the -n flag (I normally run rsync -arv) just to see that this worked, so rsync -arvn /data /backup, it grabbed all the folders/files that I just moved from /backup to /backup2, and shows them as candidates for putting onto /backup and it looks like it isn't 'following' the symlinks through to /backup2 (in other words, if you 'browse the data' its all there, just linked onto the other device - but rsync doesn't seem to 'see' that).
So - where did I go wrong?
What I want is:
Sync'ing /data to /backup and /backup2 to make up the space, but ideally as a single command like rsync /data /backup instead of having to get into exclusion masks (because I've never had good luck with those consistently working), and letting the symlinks 'fill in' the gap so that /backup2 can make up the size.
Any ideas? I did some googling and what I found was largely people wanting to rsync FROM some location with symlinks (e.g. if /data contained symlinks to some other place like /data2), but not TO some location that relies on symlinks to sort everything out.