Have your say & ask the experts!

How to sync your Mac and NAS

8 replies [Last post]
roger06's picture
Offline
Joined: 23 Dec 2007
Posts: 1643

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...)

 

 

 


 

 

 

__________________

Synology DS212J-> AppleTV->  rDAC->Naim Nait5i. Dynaudio Audience 52SE

Sony BDPS370 / YouView ->Yamaha RXV1065-> Pana TH42PX80B plasma.

Dan Turner's picture
Offline
Joined: 9 Jul 2007
Posts: 1009
RE: Computer-based music

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!

__________________

Sonos ZP90 / CA 751BD / Sky HD / Apple TV

-> AVI ADM40

-> Panasonic PDP50G10

Fred K's picture
Offline
Joined: 27 Nov 2007
Posts: 66
RE: Computer-based music

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!

 

kitchenpete's picture
Offline
Joined: 25 Oct 2010
Posts: 1
RE: Computer-based music

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. Smile

roger06's picture
Offline
Joined: 23 Dec 2007
Posts: 1643
RE: Computer-based music

Yeah it's so simple. Every time a rip a CD to iTunes I just open the terminal, type a command (which auto completes anyway) and off it goes...

 

__________________

Synology DS212J-> AppleTV->  rDAC->Naim Nait5i. Dynaudio Audience 52SE

Sony BDPS370 / YouView ->Yamaha RXV1065-> Pana TH42PX80B plasma.

The_Lhc's picture
Offline
Joined: 16 Oct 2008
Posts: 12590
RE: Computer-based music

roger06 wrote:
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's picture
Offline
Joined: 23 Dec 2007
Posts: 1643
RE: Computer-based music

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!

 

 

__________________

Synology DS212J-> AppleTV->  rDAC->Naim Nait5i. Dynaudio Audience 52SE

Sony BDPS370 / YouView ->Yamaha RXV1065-> Pana TH42PX80B plasma.

TechMad's picture
Offline
Joined: 14 Jan 2011
Posts: 233
RE: Computer-based music

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/

 

 

__________________

Samsung UE55C8000, Denon 4311, Denon DBP-2012UD, PS3, Playon!HD mini 2, KEF XQ-40, AE Pro Active 5.1

 

Samsung UE46C9000, Samsung BD-C6900, Yamaha RX-V1067, HDX-BD1, Phillips Streamium 2900, KEF 2005.3

2x8TB NAS

roger06's picture
Offline
Joined: 23 Dec 2007
Posts: 1643
RE: Computer-based music

TechMad wrote:

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

__________________

Synology DS212J-> AppleTV->  rDAC->Naim Nait5i. Dynaudio Audience 52SE

Sony BDPS370 / YouView ->Yamaha RXV1065-> Pana TH42PX80B plasma.