Hacker Newsnew | past | comments | ask | show | jobs | submit | raek's commentslogin

Regarding backups... Syncthing is great for propagating changes to all devices, but does not offer much in terms of backups and previous versions of files. (And I'm fine with that. I consider that to be out of scope for Syncthing.)

I've been thinking about solving the backup part by letting one of the devices perform btrfs snapshots on its storage. Does anyone know about any write-up that describes or compares such solutions?

Setting up a cron job / timer unit that commits the synced folder to a git repo is also an alternative, but has some disadvantages: stores contents twice (once in the sync folder, once in the git object database), and pruning older versions is difficult (git is mainly built to keep all history).


Syncthing has many options for versioning. Ability to keep versions of files is THE reason I use it.




> I've been thinking about solving the backup part by letting one of the devices perform btrfs snapshots on its storage.

I do zfs snapshots on my storage server (home desktop), which is in Syncthing's "receive only" mode. I use it to sync my camera roll and Whatsapp media files from my Android phone. I use pyznap for snapshot management.

> Setting up a cron job / timer unit that commits the synced folder to a git repo is also an alternative

Another option would be to backup the synced folder using a backup tool like borg, restic, duplicacy etc. They have options to prune the snapshots.


I have a script that takes a btrfs snapshot, uses borg to back up the consistent snapshot (to rsync.net), then removes the snapshot again. It then instructs Borg about which snapshots to retain, so my space shouldn't grow without bound.

For extra extra snapshotting fun, rsync.net then takes ZFS snapshots of the borg backup. So even if my snapshot cleaning gets over-enthusiastic, I'll still have a snapshot of the snapshot.


I’ve set up a single always on desktop computer as my backup hub. Syncthing is used to sync everything I care about to that machine, and backblaze pulls everything to the cloud as versioned backups. I use a .stignore file to exclude some things from syncing (like node_modules) and similarly backblaze is configured to exclude some things from the cloud backup. There’s also a regular local backup to an external drive (time machine). The setup took some work to figure out, but it is effectively zero maintenance and robust.


On Ubuntu (and probably other distros that use Systemd as well) you need to enable the user service manually once for your user:

    systemctl --user enable --now syncthing.service
This will start syncthing whenever your user session is active. By default that means when you login. If you run this command:

    sudo loginctl enable-linger $USER
Then your user service manager will be started at boot and run regardless if you are logged in or not. (The default behavior makes more sense on desktop and laptop computers.)


More information: https://docs.syncthing.net/users/autostart.html#using-system...

The Debian/Ubuntu packages ship all the needed files. You only need to activate them.


Thanks! I will use the enable-linger on the NAS running 24/7, and configure it using a remote browser (probably via SSH tunnel). This way I can always sync to NAS even if everything else is off, and the laptop/desktop will sync from the NAS when required.


I saw just now that there are also system units (started with "systemctl enable --now syncthing@USER_NAME_HERE.service", note the lack of --user). If you use those then you don't need to activate linger. Using those is probably considered the more standard way of doing things on an unattended server.


Nice catch, this usecase seems common enough.


Supervisord also works really well for this purpose https://docs.syncthing.net/users/autostart.html#using-superv...


For you language nerds: the author Gretchen McCulloch also hosts a podcast, Lingthusiasm! (https://lingthusiasm.com/)


Gretchen's book Because Internet, is fantastic. It was riveting and helped me get over a ton of personal grammatical hang-ups I have. The audiobook is amazing, go borrow it at your library!


You don't use another interface when thinking "IO type" instead of "IO monad". It's all about what words you use to explain the types of the interface.

For example, when you write 1 + 2 you are probably thinking of (+) being addition on integers. But a mathematician could also think of (+) as the operator from the group (Z, +, 0). Groups (a concept in abstract algebra) generalize integers, but you do not need to know group theory to do arithmetic. But it's the same operator nevertheless! Just two ways of talking about it.

Similarly, when you write putStrln "Hello " >> putStrLn "world!", the "IO type" way of thinking says: (>>) is an operator that glues two IO actions together. The resulting combined action performs the argument actions sequentially from left to right. The operator has the type IO a -> IO b -> IO b.

But you can think of (>>) in more general terms. It is not meaningful only for the IO type. It is meaningful for any type that happens to be a monad! That insight may be useful eventually, but probably not for a beginner Haskell programmer just wanting to do some IO!


Exactly. You only need to know about some primitive operations (like putStrLn and getLine), and ways to combine them (like >>, >>=, and return).

This was my point when I wrote my "IO tutorial" (not a monad tutorial!): http://blog.raek.se/2012/10/19/haskell-io-in-five-minutes/


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: