LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Using rsync to back up photo library (https://www.linuxquestions.org/questions/linux-general-1/using-rsync-to-back-up-photo-library-4175450173/)

leupi 02-14-2013 02:53 PM

Using rsync to back up photo library
 
I currently have all of my photos on my laptop and every now and then I copy them over to a server that I have set up in my house. I delete the directory 'photos' on the server and then copy the directory 'photos' from my workstation over to the server. Not real efficient. Especially since my photo library is growing.

I know that rsync only copies the changes and not the entire directory so this seems ideal. How does that work with images? I might make a small modification to an image, perhaps just change the metadata. Will rsync have any issue with this? Is rsync even the best option for something like this?

suicidaleggroll 02-14-2013 03:40 PM

rsync would be a good choice for this. It can operate in two ways - only copying the changes in files, or re-copying the entire file if it's changed. You can always start with just copying the changes, and if you find that it's not working correctly you can modify the call to copy the entire file if it's been changed. Either way it will be much better than copying over all files all the time.

leupi 02-14-2013 04:06 PM

I ran the following:
Code:

rsync -av /home/name/Pictures/ shared/name/Pictures
But got a lot of chmod errors so I changed it to
Code:

rsync -rt /home/name/Pictures/ shared/name/Pictures
and that seemed to get rid of the errors and copy the files over. I then modified one image and ran the command again. It quickly went to a waiting command line and it looked like nothing had happened. I looked in the destination folder and it had indeed updated the file.

Should I be concerned about any other switches or is rt all that I should need? I assume that r is recursive and t maintains that timestamp.

Thanks

suicidaleggroll 02-14-2013 04:13 PM

Code:

man rsync
will define all of the switches

-a is an alias for -rlptgoD, and -v just means verbose

You already have -rt in your new command, so the ones you're missing are:
-l copy symlinks as symlinks
-p preserve permissions
-g preserve group
-o preserve owner
-D preserve device and special files

Assuming you have no symlinks, devices, or special files, the only things you'll be missing are the owner, group, and permission retention, which sounds like it's a problem anyway (probably due to the way the share is being mounted). So you're fine. If you want more verbosity you could add -v or --progress to the command as well.

leupi 02-14-2013 04:17 PM

That's great, -v is what I wanted, I should have known that. Thanks again for the help.


All times are GMT -5. The time now is 03:19 AM.