Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use a laptop with a harddrive smaller than my external at home. I want to be able to mirror the contents of the full install i.e. the OS (and the whole "/" partition) as a full mirror, meaning that whats deleted in one place is deleted in both. I am assuming that I can then use either harddrive to boot and have an identical system and when both hardrives are there they will synchronize.

The next thing i want to do is a little more confusing. I want to copy the user files i.e. downloads, pictures, etc.. (the "/home" directory) but i want it to be only one way so that the larger external hardrive is holding everything and whats deleted on the instalation is NOT deleted on the external. basically moving the files instead of mirroring them. I would like though that some files, the most recent ones, are mirrored and available on both harddrives.

the question would be how do i go about this? I am new to this kind of stuff and am a little confused. I imagine that i need to use rsync but i am not sure how to.

thanks in advance.

share|improve this question

migrated from serverfault.com Apr 11 '11 at 12:44

This question came from our site for system and network administrators.

1 Answer 1

The solution is to correctly utilize the --delete option of rsync. NOT using the flag will cause target to collect all the files that ever got synchronized and things that get deleted from the source will not be removed from the target.

In your case, you want to do a full sync using / as your source, but --exclude /home so that it is not evaluated. Something like rsync -a / /mnt/external/ --delete --exclude /home --exclude /mnt, then do a second rsync for home without the delete like rsync -a /home/ /mnt/external/home/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.