|« A CCNA Security Exam Experience||Improving the Routing Table in an OSPF Network »|
|posted in General, Technical|
|by ittech2010 on September 9th, 2011||tags: Backup, CentOS, linux, RHEL, Rsync, Tutorial|
Just a quick blog about Rsync on A CentOS 5.6 box. I’m currently using Rsync to backup our Samba Server – all 500 Gigs of it!!
It’s going to take a few days but it will have an exact replica of the Samba server on the Rsync server and you don’t have to have any clients installed on other machines for Rsync to work. All you need is administrative credentials on the machine you are going to Rsync with.
Once I’ve figured all of this out, I will be setting my Rsync box to start backing up automatically every night (full backup) and also, when a file is changed on the Samba Server. I’m going to try and figure out the latter as I haven’t figured out how Rsync will be able to detect that a file has changed or been removed, etc. Once I have done so though I’m sure it’s going to be very handy, also I’ll be setting the Rsync box to backup all of the the user areas and profiles held on the DCs and also the users folder on the PCs.
First create a folder on your CentOS box in which you can mount the drive you want to backup, for example I created the folder mount_tmp and mounted our Samba share onto this folder.
The commands I have been using so far are:
mount -t cifs \\\\<ip address>\\sharename /mount_tmp -o user=<username on remote machine>%<password>
This mounts the remote drive onto the backup folder, make sure you have administrative rights on the remote machine and use the correct username and password. To start to Rsync you’ll want to create another folder on your CentOS box to actually back up to so I created a folder called Backup. To Rsync I issue the following command:
rsync --progress --stats -v -r /mount_tmp/* /backup
This starts backing up the mount on the mount_tmp folder. You can read the Rsync man pages to find out what the switches are but from memory -v enables verbosity and -r means recursive directories. You must use -r to backup folders and directories and don’t forget to use –progress and –stats as this will show you the percentage of files copied to the backup folder.
After all that is done I use the following command to check drive space:
You can set this up using the “mail” command so that you get an email of the log.
I hope this blog helps you, it has been an interesting journey with Rsync this is the first time I’ve used it.
A thread has been created on the site forum specifically for commenting on this blog post.