1

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.

1 Answer 1

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/

You must log in to answer this question.