Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 2, 2012, 03:55 AM   #1
Dan A
macrumors newbie
 
Join Date: Dec 2012
Backing up using rsync

Hi, I was wanting to create like a batch file for Apple Mac for rsync but not sure how you do this.


I just want the file to sit on my desktop and click it every time to make a backup.


These are the commands I wish to use.


rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 1
rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 2

Also I am using the -a rather than -r as it preserves the time modified stamp, whereas -r will switch it to the time it was transferred to my knowledge.

With the -a option if my computer died and I had to reimage would I still be able to access everything off the external HDD that is being used as the backup?


Any assistance would be great, i've been googling but havent really come up with much.

Thanks
Dan
Dan A is offline   0 Reply With Quote
Old Dec 2, 2012, 07:42 AM   #2
subsonix
macrumors 68030
 
Join Date: Feb 2008
All you would need to do to execute those lines is to save them to a file with the addition of a shebang (#!) and the interpreter you wish to use.

Code:
#!/bin/bash

rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 1
rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 2
Copy paste that into a text editor and save it as say, "Backup Photos" to your desktop. Open up the Terminal and enter: chmod ugo+x ~/desktop/backup\ photos and you're done.

The -a flag is a combination of many options including -r, the reason that time is preserved is the -t flag. You can read all about rsync in the manual in terminal just type: man rsync
subsonix is offline   0 Reply With Quote
Old Dec 3, 2012, 02:58 AM   #3
Dan A
Thread Starter
macrumors newbie
 
Join Date: Dec 2012
Thanks mate, all good now, just one question I still have a query on, If I am using the -a option as it copies all the permissions across, if my HDD fails for some reason and I need to reimage, will I be able to access the files off the backed copy on the external HDD

Quote:
Originally Posted by subsonix View Post
All you would need to do to execute those lines is to save them to a file with the addition of a shebang (#!) and the interpreter you wish to use.

Code:
#!/bin/bash

rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 1
rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 2
Copy paste that into a text editor and save it as say, "Backup Photos" to your desktop. Open up the Terminal and enter: chmod ugo+x ~/desktop/backup\ photos and you're done.

The -a flag is a combination of many options including -r, the reason that time is preserved is the -t flag. You can read all about rsync in the manual in terminal just type: man rsync
Dan A is offline   0 Reply With Quote
Old Dec 3, 2012, 10:45 AM   #4
subsonix
macrumors 68030
 
Join Date: Feb 2008
Quote:
Originally Posted by Dan A View Post
Thanks mate, all good now, just one question I still have a query on, If I am using the -a option as it copies all the permissions across, if my HDD fails for some reason and I need to reimage, will I be able to access the files off the backed copy on the external HDD
The permissions will be preserved so it should not be an issue as far as I can tell. The -a (short for archive) is pretty much made for different backup scenarios, there are a lot of stuff written on rsync for backups that may be worth looking into if you are concerned about it's reliability.
subsonix is offline   0 Reply With Quote
Old Dec 10, 2012, 12:30 AM   #5
denzaltrueman
macrumors newbie
 
Join Date: Sep 2012
Thanks for the nice tips. It could be good enough for getting your valuable and memorable pics and data backup using resync.
denzaltrueman is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:35 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC