How to sync your Mac and NAS

roger06

Well-known member
Dec 23, 2007
374
0
18,890
Visit site
Hi

I'm hoping this may be of help to those who have a Mac and NAS. This is a nerdy / techie solution but it's easy and free!

WHF's excellent video on moving your iTunes library to your NAS is superb, but what if, like me, you don't want to move your iTunes files? you want a separate copy on your NAS but you also want them on you laptop so you can still listen to your tunes if you take your laptop out etc.

You need to sync them. I couldn't find any suitable software for doing this, Folders Synchronizer Lite was good, but even this costs about $20.

So here's a quick, easy and FREE way to do it using a Unix program call Rsync, which is built into Mac OS (10.6 - don't know about previous versions but I'm sure it'll be there). This won't work with Windows so don't try!

1. Make sure your NAS is 'mounted' on your Mac – ie you can see it in the Finder.

2. Open the Terminal app in Applications/Utilities.

3. This will open in your 'home' folder, and I'm assuming your iTunes library is in your Music folder.

4. Depending on the folder structure on your NAS, type in the Rsync command

rsync -vau Music/iTunes /Volumes/Public/Shared Music/

This effectively copies your iTunes library to your NAS, but unlike a normal copy, it only copies what's changed. If you were to copy a 20GB library each time you ripped a new CD it would take forever... whereas with the addition of a CD or a few it'll just take a couple of minutes.

The second part of the command (/Volumes/Public/Shared Music/) may well be different for your NAS (mine's a Western Digital one).

There's also a way of doing a dry run that tells you what it's going to sync, but doesn't actually do it. You simply add an 'n' to the options

rsync -vaun Music/iTunes /Volumes/Public/Shared Music/

Now you'll probably find this command hard to remember each time - I can do it by simply typing 'sh update_nas' by setting up a shell script, but I don't want to go into too much detail here but if anyone's interested let me know.

Give it a go - try it on some test folders first to see how it works

Enjoy!

(oh - and this'll also works for videos and photos...)


 

Dan Turner

New member
Jul 9, 2007
158
0
0
Visit site
Nice one Roger. Doesn't have any immediate use for me right now, but with previous system configurations I would have killed to know how to do this!
 
A

Anonymous

Guest
A great tip Roger!

rsync is the secret sauce that keeps our work computers (around 30 user and instrument PCs, plus various Mac and Linux servers) backed up and/or synchronised. Happily handles around 5Tb of data at the moment (and that's nearly 15 million files - don't ask, let's just say not all software designers think about the implications of what they are doing!), with 2-10gb a day being added and barely breaks a sweat. It beats the pants of all the commercial software we've tried and it's free!

For windows users there are a couple of rsync-style options, but in my experience the best is to install cygwin which gives you many of the same Unix/Linux programmes as already present on OsX (and always have been). It'll take about 10 minutes to set up, and if you're feeling very adventurous, you can set the rsync command (as detailed by roger) as a "scheduled service" on Windows, or as a "launchDaemon" on your mac. (I can post details on how to if anyone is interested.) I have it running every hour and you just never notice it running, everything is just magically there!
 
A

Anonymous

Guest
Very helpful to know. I'm about to set up a NAS for the first time to use with Sonos and the ability to manage the transfers in future will be extremely beneficial.
smiley-smile.gif
 

The_Lhc

Well-known member
Oct 16, 2008
1,176
1
19,195
Visit site
roger06 said:
Mac OS (10.6 - don't know about previous versions but I'm sure it'll be there).

It'll be there on all versions of MacOS that have Darwin underneath them as it's a UNIX command, which is all MacOS is really (and explains why it works so well...).

I don't know if Darwin has cron but you could just set the system up to run that rsync command every 15 minutes or 30 minutes or once a day or however often you wanted. You would need to be a little careful to make sure the previous rsync has finished but if "at" is available then you could be clever and set it up to resubmit the job to the "at" queue once the rsync has finished, which would get around that problem. That would involve writing a small script though.
 

roger06

Well-known member
Dec 23, 2007
374
0
18,890
Visit site
Yeah but, no but...

Just 'cos OS X is UNIX underneath doesn't mean it's all there. There certainly are differences, I use SuSE a great deal at work and get used to its commands but often find ones I'm expecting on OS X and they're not there!

In fact even different flavours of Linux have difference programs, commands etc. I guess the main difference being whether the distro is Debian or Red Hat based. SuSE doesn't come with an FTP server for example, which I find amazing.

But yeah, good call on the Cron. I've just tested the crontab -e command and certainly no objections from OS X.

Thing is I'm always at my Mac when ripping CDs so it's no bother to do the sync there and then. There are three things I need to add to the script though:

1. Checking that the volume is mounted and either trying to mount it if not, or quit.

2. Not copy over some the Mac-specific hidden files (.AppleDouble etc) which seem to stop XBMC indexing properly.

3. Er, I've forgotten. sure it'll come to be soon tho!

All great fun though, this techie nerd lark!
 
A

Anonymous

Guest
I suggest using the graphical version of rsync - Grsync so u dont have to mess around with scripts. (Win/Linux/Mac)

http://www.opbyte.it/grsync/
 

roger06

Well-known member
Dec 23, 2007
374
0
18,890
Visit site
TechMad said:
I suggest using the graphical version of rsync - Grsync so u dont have to mess around with scripts. (Win/Linux/Mac)

http://www.opbyte.it/grsync/

Can't get it to work on Mountain Lion. I get an rsync error...

rsync: -s: unknown option

rsync error: syntax or usage error (code 1) at /SourceCache/rsync/rsync-42/rsync/main.c(1333) [client=2.6.9]

Rsync process exit status: 1
 

TRENDING THREADS

Latest posts