How I synchronize and backup my Obsidian Notes

Discover effective methods to synchronize and backup your Obsidian notes. This comprehensive guide covers using Syncthing, Google Drive, GitHub, Backblaze, and local backups to ensure your notes are secure and accessible from any device.

How I synchronize and backup my Obsidian Notes
Synchronizing Obsidian notes across devices, and backing everything up locally and to the cloud. Image generated using AI

Obsidian is my go-to tool for organizing thoughts, capturing and connecting ideas, and maintaining a robust Knowledge Management system. To me, Obsidian has many benefits that are hard to compete with. I don't intend to switch to another tool anytime soon. Is is central to my Personal Knowledge Management Process. That's why I want to ensure that I can access my notes from anywhere, that they are safe, and that I can recover them if needed.

In this article, I will describe how I synchronize my notes across devices and how I back them up. My approach is overkill, but it gives me a lot of confidence about the safety of my system. I hope you will find some inspiration and motivation to do something similar.

The tools I use to synchronize and backup my notes

My notes are really valuable to me. I rely a lot on them, and never want to lose those. That's why I'm taking synchronization and backup very seriously.

At this time, I use a combination of the following to synchronize and backup those:

  • Syncthing: Synchronize files across devices
  • Google Drive: Cloud storage, available from anywhere
  • Git + GitHub: Cloud code hosting with free private repositories
  • Backblaze: Cloud backups
  • NAS: Local network backups
  • Local Backup plugin for Obsidian: Local backups

Syncing is not a backup

First of all, a warning. I will describe two approaches I combine. One consists in synchronizing my notes across devices. The other focuses on backing up the data. It's important to realize that synchronizing notes across devices is not a backup solution. If you delete a note on one device, it will be deleted on all devices. If you corrupt a note on one device, it will be corrupted on all devices. That's why it's important to have a real backup strategy in place.

Those WILL fail. Mistakes will replicate everywhere, and if you rely only on synchronization, then you're doomed to lose your data.

Where my notes are backed up

I currently have many backups of my notes. This gives me peace of mind. Here is where my notes are currently backed up:

Thus, I have local backups, network backups, and cloud backups. I can recover my notes from anywhere, at any time. Each backup has clear timestamps, and I can recover the whole thing or past versions of any file.

In addition, even though I don't consider those as backups, I also have working copies of my notes in different places:

  • My PC
  • My Laptop
  • My Android phone
  • My NAS (two copies on different disks, one synchronized with Google Drive, and another through Syncthing)
  • Google Drive

Last but not least, many of my notes are also shared publicly on my blog, and on my Website using Obsidian Publish. I can actually recover those easily using this python script.

How I synchronize my Obsidian notes

For a long time, I only synchronized my notes using Google Drive, and opened the Google Drive folder on my PC directly in Obsidian. I still do that, but I've now added Syncthing to the mix.

Google Drive

First, Google Drive. In there, I have a folder for my notes, and the desktop client is installed on my Windows PC. Since Google Drive mounts a drive with the files, it's easy to open any folder on Google Drive as a vault in Obsidian.

How I synchronize and backup my Obsidian notes - google drive local.png
My notes in the locally available Google Drive folder

Whenever I make changes to my notes, the Google Drive client synchronizes those changes to the cloud. And those are thus available anywhere, with versioning for all files, and a trash where I can recover accidentally deleted files. In most cases, this is enough for me to recover from mistakes. But my Google Drive account could be banned/blocked at any time, so I don't trust it all that much.

How I installed and configured Syncthing to sync my Obsidian vault on Windows

Recently, I have setup Syncthing on many of my devices. I use it to synchronize files in all directions, which is pretty fun. The client is solid, and it all works like a charm. As an added benefit, SyncThing also includes means to version files in a dedicated ".stversions" folder, in addition to handling synchronization conflicts quite nicely. Here's how I've set it all up. To get started, I have followed an excellent guide I found on the Web.

On my Windows PC, I have installed Syncthing using Winget, with the following command: winget install --id=Syncthing.Syncthing -e.

Once installed, I have configured Syncthing to run at startup. At first, I have configured a scheduled task, but then discovered a nicer approach, using the Open Source SyncTrayzor app. I also installed it using Winget: winget install -e --id SyncTrayzor.SyncTrayzor. That application takes care of startup up Syncthing, and provides a nice tray icon to monitor the synchronization, as well as a GUI that embeds the Web UI of Syncthing:

How I synchronize and backup my Obsidian notes - synctrayzor.png
The Syncthing UI in SyncTrayzor

I had to modify the config.xml file of Syncthing to get SyncTrayzor to stop complaining. It thought it wasn't compatible with the version of Syncthing I had installed. I just modified the version on top from 37 to 35. That's just a temporary problem, and I hope it will be fixed soon. That file is located under %userprofile%/appdata/local/Syncthing:

How I synchronize and backup my Obsidian notes - syncthing version.png
Changing the Syncthing version temporarily to make it work with SyncTrayzor

Then, I created a folder in Syncthing to synchronize my Obsidian vault (still stored in Google Drive):

How I synchronize and backup my Obsidian notes - syncthing folder.png
The Syncthing synchronized folder

Next, I added a few ignore rules under "Ignore Patterns", which creates/updates an .stignore file at the root of the synchronized folder:

// Folders and files that Syncthing should ignore: https://docs.syncthing.net/users/ignoring.html
// Reference: https://publish.obsidian.md/hub/02+-+Community+Expansions/02.05+All+Community+Expansions/Auxiliary+Tools/Syncthing

// WARNING: Syncthing does not synchronise this file (.stignore)
// During setup on a new device, create a copy of the .stignore file located under "50 Resources/"

// most important one. this keeps track of your open panes and files in the app
.obsidian/workspace
.obsidian/workspace.json

// vault stats are not useful
.vault-stats

// Ignore the Git repository
.git

// Smart connections embeddings
.smart-connections

// Metadata Extractor generates these automatically, so you shouldn't sync them
.obsidian/plugins/metadata-extractor/allExceptMd.json
.obsidian/plugins/metadata-extractor/metadata.json
.obsidian/plugins/metadata-extractor/tags.json

// Ignore the files versioned by Syncthing
.stversions

I followed the useful recommendations I found here. I will probably have to update that ignore file from time to time. Since that file itself is not synchronized, by Syncthing, I have a manually created a copy of it in a sub-folder of my Obsidian vault (50 Resources). When I setup a new device, I just have to copy it manually to the root folder so that the same ignore rules are applied consistently everywhere.

In the settings of the synchronized folder, I have enabled File Versioning using the "Staggered File Versioning" option. I will experiment with this over time, but it's nice to know that I have synchronized versions of my files as well:

How I synchronize and backup my Obsidian notes - syncthing file versioning.png
File versioning configuration for the synchronized Syncthing folder

It stores all the file versions in the default .stversions folder that Syncthing creates at the root of the synchronized folder. Again, it's overkill, but hey, disk space is cheap nowadays 🍭

I have then added that folder to the .gitignore file of my Obsidian vault, so that it's not backed up in my Git repository. I don't need to backup those versions, but I might change my mind later.

People have also mentioned the Obsidian Syncthing Integration plugin, but I haven't tested that one.

How I installed and configured Syncthing to sync my Obsidian vault on Android

I installed Syncthing-Fork on Android, which is available on the Play store. That version has a much lower impact on battery life, so I heavily recommend that one.

Then, I added my Windows PC as a device. One thing to know is that every device where Syncthing is installed gets a unique identifier that you need in order to sync from/to other devices. Those unique identifiers are GUIDs, so pretty long and boring to type. Luckily, Syncthing is able to generate and scan QR codes, so that's what I used. I went to Devices > Add > Scan QR code on the phone, and clicked on Actions > Show ID on the PC. The phone detected the PC, and I accepted the connection on both sides. Boom, connected! 🎉

It worked directly because both devices were connected to my home's WiFi network.

2024-06-14 - Syncthing remote devices.png
Added the remote device in Syncthing

Then, I created an empty folder at the root of my phone's file system to store the synchronized files. Once done, I went back to the PC and shared the folder I created earlier with my Android phone by clicking on Edit > Sharing:

2024-06-14 - Syncthing shared folder to Android.png
Sharing the synchronized folder to another device

I then received a notification on my phone, and accepted the share:

2024-06-14 - Syncthing notification on phone.png
The syncthing synchronization notification on Android

Finally, I configured Syncthing to use the folder at the root of my Android file system to store the files

2024-06-14 - Syncthing android folder.png
Syncthing-fork configuration for the synchronized folder

Then it started synchronizing immediately:

2024-06-14 - Syncthing synchronization.png
Syncthing doing its job

Once done, I copied the .stignore file I put in my Obsidian vault to the root, to make sure the same synchronization rules were applied.

Finally, I opened the folder as a vault in Obsidian 🚀

synchronizing notes between machines.webp
Synchronizing notes across devices. Image generated using AI

How I installed and configured Syncthing to sync my Obsidian vault on a Synology NAS

I installed the Syncthing package for Synology by André Colomb, chose a solid password, and stored it securely. That's quite important because the NAS is available on the whole LAN, and I don't want anyone connecting to my network being able to do whatever they want...

I created a folder to store the synchronized files on my NAS, granting R/W access to the Syncthing user. I intentionally chose a folder that's automatically backed up to ensure that those will also be backed up to the cloud (more on this later).

Then, I shared the synchronized folder on my PC with the NAS as well:

2024-06-14 - Syncthing NAS shared vault.png
Sharing the synchronized folder with another device

Then, I accessed the Web UI of Syncthing on the NAS (port 8384), and accepted the share.

2024-06-14 - Syncthing NAS accept share.png
Accepting the share in the Syncthing Web UI on the NAS

And it started synchronizing as well. I love it when everything works on the first try! 🎉

How I installed and configured Syncthing on my Ubuntu Laptop

Last but not least, I also installed and configured Syncthing on my Ubuntu Laptop.

Since the version on the official Ubuntu repositories is quite old, I decided to use the official Syncthing APT repository. It included the necessary steps. Here's a copy, just for the sake of completeness:

# Add the release PGP keys:
**sudo mkdir -p /etc/apt/keyrings
sudo curl -L -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg**

# Add the "stable" channel to your APT sources:
**echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list**

# Update and install syncthing:
**sudo apt-get update
sudo apt-get install syncthing**

Then, once again, I created a local folder to store the synchronized files, ensured that Syncthing had R/W access to it, shared the folder on the PC to my Laptop, and accepted the share. This time around, I just created the folder as part of my home folder, which is also backed up with my laptop. So one more "backup" of sorts 😂

I also created and enabled a Systemd service running under my user by following Syncthing's guide:

systemctl enable syncthing@myuser.service
systemctl start syncthing@myuser.service

And boom, notes synchronized everywhere I need 🎉🎉🎉

sync notes between machines 01.webp
Synchronizing across Windows, Linux and mobile

How I backup my Obsidian vault

Now the most important part. As I said, synchronized files are NOT backups. Here's how I create actual backups of Obsidian vault.

How I backup my Obsidian vault locally

I create local backups using the Local Backup plugin for Obsidian. I have configured it as follows:

How I synchronize and backup my Obsidian notes - obsidian local backup config.png
Obsidian Local backup configuration

Most important points:

  • Backup history length (days): 0. No limit to the backup history (I use additional means to move older backups over to my NAS)
  • Backups per day: 3. I could add more, but I don't feel a need to
  • Windows output path: Adapt to your own needs. I store those on a separate disk for additional safety
  • File name: Seb-Backup-%Y_%m_%d-%H_%M_%S. I use a clear naming convention. That one could be further improved, but it's good enough for my needs, given where I archive those
  • Interval backups: Enabled. I want to have backups at regular intervals
  • Backup frequency (minutes): 360. One backup every 6 hours. A shorter interval is annoying because it "blocks" Obsidian for longer and longer, as your vault grows. My backups are ~700MB at this point, and it takes a while to create those. I don't want to be regularly interrupted by the backup process

This is what my local backup folder looks like:

How I synchronize and backup my Obsidian notes - local backups.png
Local backups created by the Local Backup Obsidian plugin

I move older ones from time to time to my NAS, using a scheduled task. On my NAS, those files are backed up to the cloud with the rest of my important data.

This part is fully automated.

How I backup my Obsidian vault using Git and GitHub

Git is a powerful versioning tool, perfect for text files, but which also works for binary files (e.g., images, PDFs, etc). My whole vault is also a Git repository that I synchronize to a private repos
tory on GitHub (a popular code hosting platform). To do this, I could use the Git plugin for Obsidian, but I prefer to handle this part manually.

I have created a private repository on GitHub, have cloned it on my machine, and moved the .git folder at the root of my vault. Then, I have created a .gitignore file:

# Ignore vault stats
.vault-stats

# Ignore Smart Connections folder
.smart-connections/
.smart-connections

# Ignore Syncthing versioned files
.stversions

For now, I just ignore the embeddings creating by the Smart Connections plugin, the files versioned by Syncthing, and vault stats. There's too much I push to Git and GitHub, but I don't care.

To synchronize my notes, I generally launch GitKraken (my favorite Git GUI), and select whatever changes I want to save:

How I synchronize and backup my Obsidian notes - Git.png
Unstaged changed in my local Git repository

This enables me to create useful/informative commits, get a clear history of the changes I've made to my vault (e.g., new plugins, configuration changes, new or updated notes, folder structure changes, etc). I rely on this documentation to further improve my Obsidian Starter Kit.

Obsidian Starter Kit
Jump straight to stress-free note-making with Obsidian
How I synchronize and backup my Obsidian notes - git usage.png
Commit history for my Obsidian vault

Thanks to this, I have:

  • A way to quickly see everything I have changed locally (and have synchronized to my other machines)
  • A way to quickly rollback changes
  • A way to quickly persist changes and backup those to GitHub

If I ever corrupt or lose everything, I can always clone my GitHub repository, and start from there.

An improvement here would be to fully automate this using the Git plugin for Obsidian, but I don't want to, because it would make it harder for me to review and apply the changes to the Obsidian Starter Kit

Obsidian Starter Kit
Jump straight to stress-free note-making with Obsidian

How I backup my Obsidian vault to my NAS using PowerShell

As I've explained earlier, my vault is synchronized to my NAS using Syncthing. In addition, I use a PowerShell script to move backups older than 30 days to my NAS. I could have used bash or python and a cron job on Linux, but since my main machine is on Windows, I prefered that approach. I didn't want to bother mounting my NAS folder using NFS within WSL...

Here's the script:

# Local and NAS backup directories
$localBackupDir = "D:\BACKUPS\Obsidian"
$nasBackupDir = "\\nas.local\backups_7\NotesSeb"

# Get the current date
$currentDate = Get-Date

# Get all the zip files in the local backup directory
$backupFiles = Get-ChildItem -Path $localBackupDir -Filter "Seb-Backup-*.zip"

# Loop through each backup file
foreach ($file in $backupFiles) {
    # Extract the date and time from the filename
    if ($file.Name -match "Seb-Backup-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.zip") {
        #Write-Output "Processing file $($file.Name)"
        $year = [int]$matches[1]
        $month = [int]$matches[2]
        $day = [int]$matches[3]
        $hour = [int]$matches[4]
        $minute = [int]$matches[5]
        $second = [int]$matches[6]
        
        # Date of that file (according to the file name!)
        $fileDate = Get-Date -Year $year -Month $month -Day $day -Hour $hour -Minute $minute -Second $second

        # Calculate the age of the file
        $fileAge = $currentDate - $fileDate
        
        # Check if the file is older than 30 days
        if ($fileAge.Days -gt 30) {
            Write-Output "Archiving the following file to the NAS: $($file.Name)"
            # Move the file to the NAS directory
            $destination = Join-Path -Path $nasBackupDir -ChildPath $file.Name
            Move-Item -Path $file.FullName -Destination $destination -Force
            Write-Output "Moved $($file.Name) to $nasBackupDir"
        }
    } else {
        Write-Output "Filename $($file.Name) does not match expected pattern."
    }
}

Write-Output "Backup files older than a month have been moved to the NAS."

That script sits at the root of my vault. That way, it also gets synchronized/backed up along with the rest ;-)
To avoid issues with file creation/modification times, I have decided to only trust the file names.

To run this script, I have created a simple scheduled task that runs daily at noon. Here's how it is configured:

  • Run powershell: powershell.exe
  • Arguments: -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File ./Archive-Old-Windows-Backups.ps1
  • Start in: %userprofile%/My Drive/Notes/Seb (i.e., root of my vault, where the PowerShell script lies)
  • Settings
    • Allow task to be run on demand
    • Run task as soon as possible after a scheduled start is missed

To be honest, this approach is far from ideal, because it implies a lot of manual work to set it all up again in case my machine crashes. Even with backups, that's too tedious... A better alternative would be to script the whole setup. It's not that hard to do.

With the above, I already have multiple copies of my Obsidian vault on the NAS. Two are synchronized copies (copy of Google Drive + copy Synchronized by Syncthing), thus not that reliable, and the above, which ensures I can go back in time if needed.

How I backup my Obsidian vault to Backblaze in the cloud

My NAS is configured to backup my most important files to Backblaze, a popular cloud backup solution. In there, I have created a number of buckets to store my backups. I use the one below to store my notes, among other things:

How I synchronize and backup my Obsidian notes - backblaze buckets.png
Backblaze bucket

Those buckets are actually Amazon S3 buckets underneath, and can be accessed through the same old Amazon S3 APIs. This means that they are compatible with many tools, including some packages on the Synology NAS.

On Backblaze, I have also created application keys to access those buckets. Those used by the backup tool on the NAS:

How I synchronize and backup my Obsidian notes - backblaze app keys.png
Application key in Backblaz

I could further lock down the permissions, but the scope of each bucket is very limited.

On the Synology NAS, I have installed the Hyper Backup application of Synology, which supports S3 backups, and thus Backblaze. I have created a backup job that uploads and versions my notes to Backblaze:

How I synchronize and backup my Obsidian notes - synology backups.png
Synology backups

That backup job also encrypts the data using a key that I've stored securely and backed up separately, because... you never know! The job runs every night, and regularly checks the integrity of the files. I have also enabled backup rotation using the following configuration:

How I synchronize and backup my Obsidian notes - backup rotation on NAS.png
Backup rotation for my NAS backups

So basically, I can go way back in time with that... And that's my last resort if everything else fails...
I have tested the restore system a dozen times already (mainly checking in to ensure it still works), but I've never faced an actual disaster. Fingers crossed!

What I haven't detailed here is that I also use Synology Cloud Sync to synchronize files I store in the cloud with my NAS, and then back those up to Backblaze. This protects me against platform risks (e.g., having my Google Drive account blocked/banned for some reason).

sync notes to the cloud.webp
Notes backed up to the cloud. Image generated using AI

And with all that, I didn't even mention the backups of my different devices. Anyways, you get the point. My data is SAFE.

Conclusion

In this article, I've covered the most important points about how I synchronize and backup my Obsidian vault and notes. By now, it should be obvious that this stuff is quite important to me, and I'm not kidding. I have local, network and cloud backups, and I synchronize my notes on various devices 😂. Hopefully though, this will give you some ideas about how to approach this for yourself.

The one thing I want to leave you with is that you should really care about properly backing up your notes. That is, if you are actually writing valuable notes, which I hope you do. And if you don't, the please go read my other articles about Knowledge Management, because you're clearly missing out.

That's it for today! ✨

References