LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   rsync usage to make one directory look exactly like other (http://www.linuxquestions.org/questions/linux-software-2/rsync-usage-to-make-one-directory-look-exactly-like-other-928515/)

rohit.dhaval1 02-09-2012 12:48 PM

rsync usage to make one directory look exactly like other
 
Hi Folks..

I have a NFS volume that contains thousands of binaries. And, hundreds of machines make use of those binaries.

example : '/usr/sf' NFS volume --> /usr/sf/bin/vim (the binary)

I have installed lot of binaries on cloned volume '/usr/sf_clone' . I need to sync all the changes to '/usr/sf'

What options should I be using with 'rsync' to make sure copying takes place recursively, with privileges maintained. At end of rsync operations, '/usr/sf' should look exactly like '/usr/sf_clone' with no duplicate files /binaries.

--------------------

I am sorry, I haven't been able to contribute to LQ :(

TobiSGD 02-09-2012 02:16 PM

Use the -a option to copy recursively and maintain privileges and the --delete option to delete files in /usr/sf that are not in /usr/sf_clone. So it would look like
Code:

rsync -a --delete /usr/sf_clone/* /usr/sf/
For more information on rsync have a look at
Code:

man rsync

rhbegin 02-09-2012 02:51 PM

I use the --delete option as well, you need to be extremely careful as you do not want to get your syntax of your command sideways as you will delete all of your data off of your production server.

Many a people have done this, like one of the posters profile states, (always have a backup) and of course test your commands on something not-production.

rohit.dhaval1 02-10-2012 08:50 AM

Thank you guys !!.. I was aware of the command.. I wanted to cross check with gurus here as, data I am playing with is of high importance.

@rhbegin : Yes I have taken appropriate backup at storage level. Thanks again !!

rhbegin 02-10-2012 09:35 AM

On TobiSGG profile

quote "Making a backup after having problems is like fastening the seatbelts after crashing into a wall."

I agree 100%

:)


All times are GMT -5. The time now is 06:39 PM.