When I want to sync my music directory to my SDcard I use the command rsync -a --delete /home/garrett/Music /media/garrett/6BF6-AC8A and everything works just fine. I got tired of typing all that in every time so I placed that command in the script ~/bin/music-sync and this is what the file looks like below


rsync -a --delete /home/garrett/Music /media/garrett/6BF6-AC8A

But everytime I run this command from the script it placed two copies of every songs on my SDcard, this problem only plauges the script version, it works fine from the CLI. I the script I also tried placing $() around the command but that version also placed two copies of every song on my SDcard. Any ideas? Thanks.

While we're on the subject of rsync and my music library, would there be a way make that rsync line have a list of exceptions for files not to sync from the source and to get that list of exceptions from a file instead of all written out on the CLI itself? Thanks again.

3 Years
Discussion Span
Last Post by rch1231

I had a lot of success using luckybackup instead of rsync (actually, luckybackup wraps rsync but I think it is much easier to use). You can install it with apt-get.

Luckybackup comes with a GUI in which you define job profiles. So here a job profile would contain that you want to backup your /home/garret/Music folder to the destination /media/garrett/6BF6-AC8A and you can exclude files the way you want and include all sorts of parameters in your job profile through the GUI.

Once the profile is written, you can run the job, or run it regularly using a cron task. You can also run the job by invoking luckybackup with convenient parameters on the command line.

Edit: note that you may need a symlink

sudo ln -s /media/6BF6-AC8A /media/garrett/6BF6-AC8A

if luckybackup says that the destination is not mounted.

Edited by Gribouillis



I think that you will find that the problem is due to the SD Card having a FAT filesystem and not a Linux file system. FAT doesn't track modification times on files as precisely as, say ext3 (FAT is only precise to within a 2 second window). This leads to particularly nasty behavior with rsync as it will sometimes decide that the original files is newer or older than the backup file by enough that it needs to re-copy the data or at least re-check the hashes.

Try this in your script and obviously you need to replace $Source and $Dest as applicable

rsync --progress --modify-window=1 --update --recursive --times --delete "$SourceDr" "$Dest"

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.