10 minute read

How I sync my notes

I avoided paid note sync services and now keep all my Obsidian notes synced across devices—completely private, fully under my control, and always accessible.

The setup

Ever since moving to Linux I have been using a new notes app.

It’s Obsidian, and for just $4 USD a month I would be able to sync all my notes across all my devices using Obsidian’s own sync service. Not that bad.

But you know, as I have been doing recently, I’d rather have one less subscription than one more. So instead of just pulling the trigger on it, I looked elsewhere.

Previous approaches

Obsidian also happens to have an excellent collection of community plugins. Can you guess what I first searched when I found about it? Syncing plugins! And guess what? They do exist! Plenty of them, actually! It’s funny how the tools Obsidian lets the community build end up doing the job their subscription was supposed to.

With community plugins you can sync with accounts ranging from Google, Microsoft, Dropbox, to your own WebDAV server… You name it. There are numerous choices.

But I started with github-gitless-sync. Because A) it works on mobile devices, which not all of these sync plugins do, B) since I would be syncing it myself, might as well get it versioned, right? And C) a GitHub repo sounded about the perfect place for me to keep my notes.

The issue, which I assume is going to be true for other git-like plugins, is the fact that once in a while I needed to move a file around, or rename it, or even delete it. But for some reason, when I did—and believe me when I say it took me quite a few tries to figure out a pattern—the syncing wouldn’t happen. It just complained about a missing blob. The only way to fix it was going back to the device where I have moved/renamed/deleted the file and put it back where it was. Then the sync would happen again.

I got tired of it. Very quickly.

Eventually, I looked for other plugins that would allow me to maintain my GitHub repo setup, but just change the tool itself. I was convinced the tool was the issue. But I figured the issue would be related to git more than anything. Not exactly sure how git affects a “gitless” plugin, but you know…

It’s weird though, because for changes within a file, sometimes the plugin would ask me to solve conflicts.

Anyway, I abandoned the GitHub idea and started to wonder why don’t I sync with a personal account instead? Even though I have moved away from Google, for the most part, I still have my Google account. And I still use Sheets and Docs, especially when I need to share the files. But then I remembered I don’t want to trust Google with personal data that I don’t need to. And yes, I am aware GitHub is owned by Microsoft anyway.

So, what other options do I have? I have a NAS already…

A local approach

What if, I could sync all my notes, to my own NAS? It’s just “personal cloud” anyway.

Actually! What if I could sync my notes to my own NAS without even needing internet at all? That’s ambitious!
This means I wouldn’t need to rely on third party services. This means my notes would remain private. Really private! Hosted on my own hardware. Far away from the hands of tech giants.

If you’re anything like me, this is enough for you to consider pursuing this route.

It’s possible

Enter Syncthing: a continuous file synchronisation tool.

The idea is to have a folder in my own NAS containing all my notes, which is then magically synced between other devices over the local network. For my use case, I’m going to need to access these notes in 2 devices: a tablet running iPad OS and a computer running Linux.

There are 2 relevant concepts for Syncthing:

How I did it

Since I already have a NAS running all the time, I decided to install Syncthing on it through Docker, which is called Container Manager in DSM.

After installing it and starting the container, I have access to it through http://[MY-NAS-IP]:8384. This launches a web interface where I’m invited to set up a user and password to prevent unauthorised access.

Now one thing I should mention upfront is that, even though I mentioned above I would be syncing my notes across two devices (iPad and computer), the reality is that since I have access to my NAS through the computer—I really just need to mount the network drive—I haven’t set up the computer as a device in Syncthing. But I could have. And perhaps I will at some point. But that changes the setup a bit.

So the only device I need to add to Syncthing is the iPad, really! For that, I’m going to be using an app called Synctrain. Synctrain enables me to use Syncthing on the iPad, which is exactly what I need. In there, there’s a unique device ID—a very long string of 8 groups of 7 characters each. This ID is going to be needed to ”connect” the iPad to the instance running in my NAS—let’s call it server. And likewise, the server also has a device ID that needs to be connected to the iPad.

With that aside, it’s time to add a folder.

Since this container has access to a shared folder in my NAS, I just need to create a folder inside Syncthing pointing at the shared folder. Folders are synced based on unique IDs, just like devices.

Every new folder you create in Syncthing is going to have an ID assigned to it.

Adding a folder is a similar process to adding a device. After creating a folder in Syncthing pointing at the shared folder on my NAS, I need to add the same folder—through its ID—to Synctrain which is going to be synced with the devices I specify—in this case, the server only.

But there’s a small trick here!

You see, I mentioned above I’m using Obsidian to write my notes. On the iPad, Obsidian fetches the notes from the /Obsidian/[my-vault] folder. So when creating a folder in Synctrain, I need to point it at this already existing folder.

This way, Obsidian will load the notes that are actually coming from my NAS, without even knowing it.

Caveats

The fact that this isn’t just another Obsidian plugin running, in theory, makes it possible to sync even before Obsidian launches. That’s the theory, at least. Because in practice, Synctrain may disconnect when running in the background, preventing the syncing from happening in the first place. Perhaps the iPad kills the background services at some point for background apps?

It should be noted though, that my workflow usually involves writing blog posts—like this one—on the iPad first and only occasionally finish on the computer.

For some reason, I find this workflow makes things very smooth. But I’m not sure how smooth it would be with a much more dynamic flow with plenty of other devices and folders. I literally have 1 folder and 1 remote device—the Syncthing instance running on the NAS it’s considered a device, but not a remote one.

Something else to consider is the fact that I write mostly at home. This means that my NAS is always accessible through my local network. When I’m not at home, I can still write on my iPad as I would. Synctrain will then sync my notes when I get home without the need for me to do anything. I might need to open the app, but that’s it.

If you happen to write on the go, or happen to need to sync with more devices that are on the go most often than not, you may need to expose your Syncthing instance to the outside world. That’s one more thing you need to worry about, since it’s now on the internet.


I personally have a similar setup for my Home Assistant, which is also running on my NAS and I do need access to it on the go. For that, I’m using a Cloudflare tunnel which happens to take care of SSL for me too.

Takeaways

After testing this setup for a while, I’ve realized that self-hosting your notes isn’t as complicated as it sounds. You can keep your workflow smooth, maintain full control over your data, and still have your notes available across devices without paying for yet another subscription.

Here’s what you can take with you:

Photo of Pedro