Rsync
RSYNC two networked drives
I'm attempting to syncronize 2 networked storage drives. The drives are
/media/sata500 /media/freeagent
Some goals:
* Occasional manual sync. * One drive mirrors the other in terms of total content. * Don't copy music just because metadata has changed, or, overwrite the file. Don't make a new copy of the file. * Be able to move or delete files on one disk and have rsync pick up on this and make the same changes on the other disk.
The sata500 disk is on the CentOS5 box. The /media/freeagent disk is on the Slowhand box. All computers are networked and the drives are accessible through the network.
My goal here is to use rsync to make both storage disks mirror one another.
The first successful test command was
rsync -rv /media/sata500/backup/ glenn@slowhand:/media/freeagent/
The result was
sent 26912857 bytes received 692 bytes 1856106.83 bytes/sec total size is 26907573 speedup is 1.00
Does this mean that a folder "backup" was created on the freeagent drive and that all of the files from the backup folder on the sata500 drive were copied over to /media/freeagent/backup? No. Actually, that folder was not created but the three sub-folders that are under backup were created in the root of the freeagent drive. The reason I didn't get the desired behavior is the trailing / at the end of the source path. The new command is
rsync -rv /media/sata500/backup glenn@slowhand:/media/freeagent/
The result was
sent 26912873 bytes received 698 bytes 1736359.42 bytes/sec total size is 26907573 speedup is 1.00
The folder backup was created and all of the sub-folders and files were transferred.
I'm not sure that this command is only backing up files. I believe that it is actually just copying all the files every time I run it.
Added the -a option to the rsync command. Then I created a new test file in /media/sata500/backup and ran the rsync command again. This time, only the new file was transferred.
[glenn@centos5 ~]$ rsync -arv /media/sata500/backup glenn@slowhand:/media/freeagent/ glenn@slowhand's password: building file list ... done backup/ backup/test.txt
The result was.
sent 737 bytes received 48 bytes 174.44 bytes/sec total size is 26907573 speedup is 34277.16
By changing the source path I've been able to copy 2 or 3 more folders from the source to the destination. The operation appears to have stalled while copying a very large file. Other than that things are progressing.
The 250GB USB FreeAgent desktop drive is getting low on space. I'm going to reverse this process and backup that drive to the 500GB internal hard disk.
Local Repository
Example ...
sudo rsync -av rsync://mirror.clarkson.edu/fedora/linux/releases/12/Everything/i386/os /media/disk2/repof12/
This gets files from the clarkson rsync server and deposits them in /media/disk2/repof12/.
Return home
