0

I have to HDD drives on two different servers that I need to sync regularly. Until now, I've been using rsync over sshfs, first from one to the other, then from the other to the first, but this method is proving unsatisfactory. When a file is removed from drive A, it is not copied to drive B, but then copied from drive B to drive A. So I can never remove anything unless I do it from both drives. The same goes for renaming - renaming a directory on one drive soon results in two directories with different names but the same contents.

Ideally I need something that keeps track of changes on one drive and then duplicates these changes on the other. Any suggestions?

11
  • 2
    Why do you need two separate disk drives? Why not just use a network-shared file system such as NFS? Jul 1, 2021 at 12:50
  • 3
    "rsync over sshfs" is a terrible idea. If you want to use rsync just use it between the two systems directly - it can use ssh natively
    – roaima
    Jul 1, 2021 at 13:04
  • 1
    Do the two servers have a short, fast network path between them (e.g. on the same LAN, not on the other side of the world over the internet using RFC1149)? If so, you could set up a network RAID-1 array using DRBD.
    – cas
    Jul 1, 2021 at 13:19
  • 2
    @OZ1SEJ If you're syncing all changes, you're just reimplementing RAID-1. if you need backups, do real backups. What you're doing is not a backup - if you succeed in fully synchronizing all changes including deletes, when someone accidentally deletes everything, your mirroring will reliably replicate that loss of all data. Jul 1, 2021 at 13:53
  • 2
    @OZ1SEJ By "real" backups, I mean real backups. See Why is RAID not a backup? Your disk-syncing scheme is just mirroring - and to quote one answer that I linked: "If you accidentally overwrite your PhD thesis with garbage, redundancy ensures that you have multiple copies of garbage, in case one gets bad. A backup ensures that you can restore your PhD thesis." Jul 2, 2021 at 12:39

2 Answers 2

0

If you can afford having a third server storing the files you could use Nextcloud. (You could also host it in one of those servers themselves if there's not a third place available).

In my experience it works well tracking changes from multiple places unless you have some machines on and others off at the same time; in such case, file diff conflicts start appearing easily.

It seems that this question in ServerFault might be a best fit, though: https://serverfault.com/questions/924294/master-master-file-sync-between-datacenters

0

Have you considered Syncthing?
It can continually sync files and if your two devices can communicate directly, you don't even need a relay server as they can sync directly.

https://syncthing.net/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.