LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Rsync guru needed (https://www.linuxquestions.org/questions/linux-software-2/rsync-guru-needed-4175492705/)

chriscrutch 01-27-2014 02:00 AM

Rsync guru needed
 
I need an rsync wizard.

The situation: I use rsync to backup my /home folder to an external HD. / is on one internal drive, /home/chriscrutch is on that same internal drive, /home/chriscrutch/Documents is a symlink to a folder on a different internal drive. Because it's a symlink, I have to use the rsync option to transform symlinks into the referent file, otherwise none of the files in that folder (or sub-folders) get backed up.

The problem: transforming symlinks into the file results in clogging the backup drive with old files no longer present in the source, even with the --delete option. That's fine for a while, but after a time my backup drive runs out of space because of the storage of old, long-deleted files. Is there a way to get rsync to clean those out even though they're all, sort of, symlinks as opposed to regular files?

The command:
Code:

rsync -r -t -p -o -g -v --delete -D --partial -L /home/chriscrutch /media/truecrypt1
Thanks!

--chriscrutch

druuna 01-27-2014 03:54 AM

I would split the problem you are facing with the above rsync command into two rsync commands.

The rsync command as shown creates real files when it encounters symlinks and, as noticed, you will end up with files that aren't removed.

Why not use one rsync command to back up your home directory (including safe simlinks) and one rsync command to back up the data that is outside your home directory.

safe simlinks are those that stay inside the tree:
- A link from /home/chriscrutch/foo to /home/chriscrutch/Tmp/foo is safe
- A link from /home/chriscrutch/bar to /data/chriscrutch/bar is unsafe.

You could use something like this to back up your home directory:
Code:

rsync -a -v --delete -D --partial --safe-links /home/chriscrutch /media/truecrypt1
And something similar for the real location of Documents.


All times are GMT -5. The time now is 09:32 AM.