File Synchronization (a.k.a. File Sync) is the process of ensuring that two or more locations contain the same, up-to-date, files. If you add, change, or delete a file from one location, the synchronization process will add, change, or delete the corresponding file at the other location. Synchronization can be “two-way” or “one-way”.
I'm using the syncing tool Unison with my Mac OSX and Ubuntu 9.10 machines to backup my music from Mac to Ubuntu. The thing is, I want to have my Mac be the source and Ubuntu be the target so that the Ubuntu machine will be an exact copy of the Music folder on the Mac at all times, but if I delete something from Ubuntu, it won't get deleted on the Mac. I've looked at the docs but it is kind of going over my head at the moment.
roflwaffleroflwaffle
migrated from stackoverflow.comJan 18 '10 at 21:02
This question came from our site for professional and enthusiast programmers.
5 Answers
A better tool for the job might be rsync (you'll need to install it on both computers). I use it to keep my laptop music folder in sync with a home file server, which is pretty similar to your situation. rsync specializes in keeping a mirror copy up-to-date.
A command line like this might be useful (assuming you run it from Ubuntu):
It is pretty easy to switch the above line around if you want to run it from your Mac and push to the Ubuntu computer instead of pulling.
TheToasterThatCouldTheToasterThatCould
Use
unison -force
:Manual:
Including the preference
-force root
causes Unison to resolve all differences (even non-conflicting changes) in favor of root. This effectively changes Unison from a synchronizer into a mirroring utility. You can also specify -force newer
(or -force older
) to force Unison to choose the file with the later (earlier) modtime. In this case, the -times
preference must also be enabled. This preference is overridden by the forcepartial
preference. This preference should be used only if you are sure you know what you are doing!E.g. (using socket mode). Start up unison listener in the directory that you want to be a mirror of something else. Target that socket in the unison client call. Force causes changes to be all ONE WAY from the given root.
Elsewhere or on the same host:
Rich K.Rich K.
Whilst the answer by TheToasterThatCould will 'work', please note that it will not correctly backup Mac file system 'Resource Forks'
Whilst the Mac OSX version of rsync is resource-fork aware, linux versions of rsync are not (and likely will never be, because the Apple version of rsync is OSX-specific and does not present those resource forks to rsync on the other end in a way that a non-OSX version of rsync can handle). The result of this is that resource forks will not be rsync'd between Mac and linux machines.
Certain Mac apps utilise resource forks to store data related to the particular file. If you are certain that your files you are syncing don't need or use resource forks, then it should be OK to use rsync.
If you want to sync resource forks, then unison will be the better approach because (according to unison docs) it can sync resource forks.
allnaturalallnatural
FreeFileSync is an open source application which is capable of mirroring a directory. It can run for one way or two way synchronization or in 'contribute' mode. I can say that it can do the job of Microsoft's Synctoy. FreeFileSync can be freely used in Mac OS X, Linux and Windows.
ReadyPlayerOneReadyPlayerOne
Currently,
unison /home/test/thing2 /home/test/thing2 socket://somehost:123456/ -silent -batch
will work, where -batch
indicates no questions at all정진홍정진홍
Not the answer you're looking for? Browse other questions tagged linuxmacbackupsyncunison or ask your own question.
I would recommend rethinking this to have the same technology on both ends, either it should be Synology & Synology or CentOS and CentOS. For both you will use the RSYNC as needed.
See the instructions on how to use RSYNC with Synology
https://www.synology.com/en-us/knowledgebase/DSM/help/DSM/AdminCenter/file_rsync
Backup Linux to Synology
https://www.synology.com/en-us/knowledgebase/DSM/tutorial/Backup_Restore/How_to_back_up_Linux_comput...
How about the backups of your Synology and CentOS Server besides sync?