Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Apr 11 '11 at 12:44

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

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

You must log in to answer this question.