You are not logged in.

#1 2013-07-18 18:45:33

cdwijs
Member
Registered: 2010-04-24
Posts: 162

(r)sync multiple computers, howto delete files?

Hi All,

I would like to use rsync to sync my home directory across multiple machines. When I invoke rsync like this, I get the new and modified files from the server
rsync 192.168.x.y:/home  /home

Then with a second rsync command, I push my new and modified files to the server:
rsync  /home 192.168.x.y:/home

This works perfectly when I'm only adding and modifying files, but when I remove a file from my PC, and then sync with the server, the file is restored. I don't know a way to delete a file without the other workstation restoring it.

I can also invoke rync with the --delete flag. But this does not work well when I sync from a second PC with the server, the 2 workstations will then delete the new files the other machine has made on the server.

So my question is: How can I remove a file from a set of sync'd machines? I have heard about clustered filesystems, but I think this is a bit overkill for the 4 PC's that I and my wife use :-)

Suggestions are much appreciated.
Regards,
Cedric

Offline

#2 2013-07-18 19:09:48

karol
Archivist
Registered: 2009-05-06
Posts: 25,430

Re: (r)sync multiple computers, howto delete files?

Why do you do it?
Maybe having /home on the server so you can mount and access it from any of the PCs would be easier?

Offline

#3 2013-07-18 19:22:58

cdwijs
Member
Registered: 2010-04-24
Posts: 162

Re: (r)sync multiple computers, howto delete files?

karol wrote:

Why do you do it?
Maybe having /home on the server so you can mount and access it from any of the PCs would be easier?

Keeping stuff on the server is indeed more easy, but for me, it has a few drawbacks:
1) The data is further away, On my desktop I now have my data on a fast ssd, accessing it over the network will be a bit slower. The situation is worse on my laptop, it's wlan is only 1.5MB/s. But this is not a big problem, as the data will be cached in RAM on the clients.
2) The server has to be always powered. When my server is not powered, I cannot access my data. I do not like the idea to keep a server running when it's not used, eg. when all the clients are off. Ideally, the server would only run when one or more of the clients are online. I can imagine this can be done by letting the server ping the clients periodically, and then power-down when nobody replys, and let the clients send wake on lan packets when they want the server back. But then the user has to wait until the server is back online before he can access his data.
3) There always has to be an internet connection between the server and the clients. When I take my laptop to a place where I don't have internet, then it would still be nice to be able to show somebody pictures, or listen to some music.

Best regards,
Cedric

Offline

#4 2013-07-18 19:31:32

geno.nullfree
Member
From: en_US
Registered: 2013-05-29
Posts: 17

Re: (r)sync multiple computers, howto delete files?

It kinda sounds like you want a content versioning system repository rather than a synchronized file system.
I'd recommend subversion (svn) rather than rsync for what you're trying to do. that way, if you delete a file from the svn repo (svn delete command rather than rm) it will not be re-synced the next time you update your local files.

Offline

#5 2013-07-18 19:42:29

progandy
Member
Registered: 2012-05-17
Posts: 2,151

Re: (r)sync multiple computers, howto delete files?

unison or csync might be better options than rsync. rsync isn't really built for two way sync.
csync might be the easier to understand at the cost of flexibility

Offline

#6 2013-07-18 19:43:39

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,695
Website

Re: (r)sync multiple computers, howto delete files?

You can achieve this using rsync options (e.g. --delete) and careful ordering of the directionality, but that is error-prone.

Try unison. It is basically a bidirectional version of rsync for synchronizing multiple systems and it is designed to do what you are trying to do. It is available in [extra] so you can install it with pacman.

Offline

#7 2013-07-18 19:46:41

karol
Archivist
Registered: 2009-05-06
Posts: 25,430

Re: (r)sync multiple computers, howto delete files?

I too thought of a content versioning system or unison, but rsync should be able to do this ... unless you're working on more than one machine at a time.

Offline

#8 2013-07-18 19:48:27

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 19,019
Website

Re: (r)sync multiple computers, howto delete files?

You should also look at Unison...

Sigh. Too slow on my phone...

Last edited by jasonwryan (2013-07-18 19:49:34)


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB