PDA

View Full Version : Linux help... using rsync



gutted
2008-04-27, 05:33
So - this isn't SB related, but wondering if anyone can give me some advice on how to efficiently backup my music drive?

My music is on a Windows (2k) file server, but I recently bought a cheap NAS with a Linux OS. I'd like to use rsync to check for changes on the Windows file system, and then make any changes as required on the NAS. (Until now I've been using MS Synctoy, but Synctoy doesn't delete folders that have moved or been renamed - and you end up with loads of empty folders in the backup destination).

Anyway - rsync looks good, but I'm a bit of a newbie when it comes to Linux. I guess that the Linux OS can't read the Windows filesystem at the moment, and I'm expecting to have to mount the music drive within Linux.

I've done some googling, but now yet found anything all that helpful. Can anyone give me a couple of pointers (e.g. a link to a tutorial, or even just general info)?

Cheers in advance! (and sorry for asking such a blatantly non-SB question :)

nolan
2008-04-27, 05:56
I've done something similar in the past to back up the Music directory on my Linux based server (which I use to run SqueezeCenter) to the external USB drive connected to my Windows desktop.

1. Share the folder from your Windows machine.
2. Mount this to your Linux box

mount.cifs //192.168.0.10/Slimserver /homerdrive/Slimserver -o user=nolan

3. Perform the rsync. The --delete flag also replicates deletions from the source.

rsync -ar /home2/Slimserver/* /homerdrive/Slimserver --modify-window=10 --delete --progress

192.168.0.10 is my Windows machine and /homerdrive/Slimserver is the mount point for the Windows share I have created on my Linux machine.

I'm doing something sightly different now as I bought a 1TB WD Netbook (as sold by PC World for 150) which after a few simple hacks turns into a tiny Linux server so my Windows box isn't involved any more but this backup method worked fine when I was doing it.

gutted
2008-04-27, 06:02
I've done something similar in the past to back up the Music directory on my Linux based server (which I use to run SqueezeCenter) to the external USB drive connected to my Windows desktop.

1. Share the folder from your Windows machine.
2. Mount this to your Linux box

mount.cifs //192.168.0.10/Slimserver /homerdrive/Slimserver -o user=nolan

3. Perform the rsync. The --delete flag also replicates deletions from the source.

rsync -ar /home2/Slimserver/* /homerdrive/Slimserver --modify-window=10 --delete --progress

192.168.0.10 is my Windows machine and /homerdrive/Slimserver is the mount point for the Windows share I have created on my Linux machine.

I'm doing something sightly different now as I bought a 1TB WD Netbook (as sold by PC World for 150) which after a few simple hacks turns into a tiny Linux server so my Windows box isn't involved any more but this backup method worked fine when I was doing it.

Dude - you rule :) Thanks, man.

And yep - I've done exactly same thing as you: I bought a WD MyBook World Edition (MBWE) 1TB drive for 150... I've already done the same as you and SSH'd into it and added Optware and then rsync (and a couple of other bits). Even after a firmware upgrade, the transfer speed is hellishly slow :( I'm hoping rsync might be a bit more efficient in backing up my music...

Cheers again for your advice - I'll get onto that now.

EDIT: I see that you've also decided to ditch compression... Me too :) It's one of the first things I read about when trying to reduce CPU usage on the MBWE, given that the transfer speed is already so poor. It's such a shame that the hardware can't actually cope with gigabit Ethernet speeds - but I guess at 150 I can't really complain...

raven22
2008-04-27, 07:57
maybe this can help?

http://backupnetclone.sourceforge.net/

nolan
2008-04-27, 08:18
If you are going straight between two Linux machines you can do the rsync direct and forget about using shares

To begin with I added the netbook into the /etc/hosts file on my Squeezecenter box
192.168.0.5 netbook

I then added my own squeezebackup directory in the /shares/internal directory on the netbook:
[root@BigBook internal]# pwd
/shares/internal

[root@BigBook internal]# ls -l
total 40
drwxr-xr-x 2 www-data root 4096 Mar 24 15:26 BETH
drwxr-xr-x 5 nolan root 4096 Mar 27 2008 NOLAN
drwxr-xr-x 11 nolan root 4096 Mar 27 2008 PICTURES
drwxrwxr-x 2 root www-data 4096 Dec 1 2006 PUBLIC
drwx------ 2 root root 16384 Nov 12 14:14 lost+found
drwxrwxr-x 6 nolan nolan 4096 Apr 25 2008 squeezebackup

Then I performed the rsync:
root@Pie:/home2# rsync -ar /home2/Slimserver/ nolan@netbook:/shares/internal/squeezebackup --delete --progress
nolan@netbook's password:
Could not chdir to home directory /home/nolan: No such file or directory
building file list ...
10297 files to consider
deleting Media/Compilations/Clerks 2 Soundtrack/.02 - Talking Heads - Nothing But Flowers.flac.5k2Ux5
./
Media/
Media/Compilations/
Media/Compilations/Clerks 2 Soundtrack/
Media/Compilations/Clerks 2 Soundtrack/02 - Talking Heads - Nothing But Flower.flac
..... and so on ....

It is pretty slow but it's fine for a backup device and especially for 1TB at that price :)
Let me know if you have any problems...

cheers, Nolan

SuperQ
2008-04-27, 10:05
Another good backup application to use is BackupPC. You simply run this on your linux machine and it will backup all of your machines via CIFS or rsync. (Will backup windows, mac, linux)

It does a copule of nice things that a simple rsync won't do:
1: If you have the same file on 2 computers, it only keeps one copy.
2: If you have a laptop, it will ping to know when it's back online, and start backups.
3: It keeps daily changes so you can restore files from a few days ago if you need them back.

I use backuppc to backup my girlfriend's laptop, and in a colo space to backup linux servers.

http://backuppc.sourceforge.net/

gutted
2008-04-29, 01:58
Thanks lads. I really am liking the idea of rsync as an alternative to SyncToy as a backup of my music RAID array, so will persevere to try and get it working... I've posted on a couple of other forums to find out whether the hardware I'm using is capable of running mount.cifs (that looks to be the simplest, if it's possible).

But again - cheers for your help and advice, guys. Much appreciated!

Dan.

4mula1
2008-04-29, 03:51
The great thing about rsync is that it can work over an ssh tunnel. I use it that way to backup my Slug to the Slug at my parent's house. Poor man's offsite backup! It runs via a cron job using a keypair so it's totally automated.