banner
Wayne

Wayne

Do what you love, love what you do
github
bilibili
telegram

My Obsidian synchronization + backup plan

The following is only my personal opinion. Please forgive me if there are any mistakes.

Overview of Synchronization Plan#

I have been using Obsidian for a year, and for the multi-device synchronization of Obsidian, I have finally adopted the following synchronization and backup plan:

  1. Synchronization using Alibaba Cloud OSS
  2. Windows scheduled task to compress the Obsidian directory to another folder for backup

Explanation of Reasons#

Why did I choose this approach?

Previously, I used OneDrive for synchronization and a GitHub repository for backup.

Insufficiency of OneDrive Synchronization#

However, OneDrive does not provide webdav services (or maybe I couldn't find it), so I used the Koofr tool to generate a webdav service for OneDrive. This method is not ideal because the Koofr service is sometimes unstable and slow, often causing the failure of the remotely-save plugin synchronization (after all, it is not an official service).

Insufficiency of GitHub Backup#

As for backup, I regularly synchronize the entire Obsidian library to a GitHub repository, including my Obsidian configuration (of course, it is a private repository). But recently, I found that my backup directory is getting larger and larger (1.5GB), and when I checked the Obsidian library, it was only 250MB. When I looked at the .git files, oh my, they were over 1GB. I am not a programmer, so I dare not delete them randomly. If I keep the current situation, I will have to copy the entire directory to the next system migration to achieve seamless backup. Also, I found that my git push is very slow (not a network problem).

Backup is really, really important. Losing something like notes can be really distressing. Once, when I was reinstalling the system, I forgot to back up my notes. While I was feeling sad, I suddenly thought: Hey, didn't I back up the entire Obsidian folder on GitHub? I can just pull it down, no loss, and my notes are back, and the configuration is not lost either.

Implementation of the Plan#

Alibaba Cloud OSS Synchronization#

Since I don't use OneDrive for synchronization, how about using another cloud storage service? I have used KuGou Cloud before, but the synchronization experience was not very good. It was unstable and had a monthly traffic limit of only 1GB, which is enough for note-taking, but I have other synchronization services as well. Considering the current shortcomings, I finally decided to use Alibaba Cloud (other vendors like Qiniu Cloud can also be used) OSS. I purchased a 3-year 40GB standard resource package for 27 yuan (it's better to buy a standard resource package for files that require frequent reading and writing), and the price is quite affordable. 40GB is enough for note-taking, and it can also be used to build an image hosting service.

Configuration Required on the Alibaba Cloud Side#

First, purchase the Alibaba Cloud Object Storage Service (OSS) resource package. I purchased the 3-year 27 yuan 40GB standard version package, you can purchase according to your own needs.

After the purchase is completed, go to the console and click on Bucket List on the left side to create a Bucket with any name and select the region closest to you. You don't need to worry about the other settings.

After creating the Bucket, go to the Bucket and click on Data Security and then Cross-origin Settings to create a rule. Fill in the Source with:

app://obsidian.md 
capacitor://localhost 
http://localhost

Check all the Allowed Methods and fill in Allowed Header with: *. After filling in, click OK.

Next, you need to authorize a user to access and manage the Bucket. Click on the avatar in the upper right corner of Alibaba Cloud and go to AccessKey Management. If it is displayed like this, click on Start using sub-user AccessKey.
image

Then, you will be taken to the user management page of Identity Management. Create a user with any login name and display name. Here, I set it to be the same as the name of the Bucket I created for easy identification. Remember to check OpenAPI Call Access. After clicking OK, your AccessKey ID and AccessKey Secret will be displayed. Copy them down, as this page will only be displayed once.

Next, go back to the Bucket page and click on Permission Control and then Bucket Authorization Policy. Add a new authorization for the user you just created. Check Sub-account for Authorized User, then select the user you just created. Check Full Control for Authorized Operation, and leave the rest unchanged. Click OK to complete the Bucket policy authorization.

Configuration Required on the Obsidian Side#

Here, we still use the remotely-save plugin. If you haven't installed it, you can search and install it directly from the community plugin marketplace (requires a proxy tool).

For the remote service of remotely-save, we choose S3 or S3-compatible service. Then, go back to the Bucket management page and find the service address (Endpoint) and region (Region) of the Bucket. Click on Overview of the Bucket, copy the information corresponding to the regional node, and paste it into Obsidian. Then, paste the AccessKey ID and AccessKey Secret you copied when creating the user into the corresponding positions. Fill in the name of the storage bucket (Bucket) with the name of the Bucket you created.
image

At this point, the synchronization part has been configured. Click on Check to see if it can connect. If it can connect, it means the configuration is correct. You can set up automatic synchronization in remotely-save. I usually set it to synchronize automatically every 5 minutes and synchronize automatically 1 second after startup.

Windows Scheduled Task Backup#

As mentioned earlier, there is a problem with the backup. The .git folder is too large. Some online sources suggest deleting the .git folder and starting a new repository, but this is not a fundamental solution and is troublesome. Moreover, the backup speed of git itself is slow in China. Now I have abandoned this method. After thinking for a long time, I decided to use Windows scheduled tasks. Every time I turn on the computer, I use WinRAR to compress the entire Obsidian folder and backup it to the D:\Backups directory (which is synchronized with my Google Drive). The specific steps are as follows:

Press Win+R and enter taskschd.msc, then press Enter. Click on Create Basic Task on the right side, and fill in the name and description as desired. Choose When the user logs on for the task start time. Select Start a program for the task action, and fill in the path of the WinRAR program in the Program/script field. Fill in the optional parameters as follows:

a -r -ep1 -ibck "parameter1" "parameter2"

If you are a 7zip user, fill in the path of the 7zip program in the Program/script field, and fill in the optional parameters as follows:

a -r -bb3 -bd "parameter1" "parameter2"

Parameter 1 specifies the path and name of the compressed file. For example, here I write D:\Backups\obsidian, which will compress it as the obsidian.rar file in the D:\Backups\ directory. If you are using 7zip, it will be compressed as the obsidian.7z file by default. You can also specify the file type by directly changing parameter 1 to D:\Backups\obsidian.zip, which will be compressed as a zip file.
Parameter 2 specifies the address of your Obsidian library folder.

That's it! I often use Google Drive for backup because it allows you to choose the backup directory freely and the speed is good (of course, it requires a proxy). You can also write the parameter 1 as the path of your OneDrive (or iCloud for Mac), so it can be automatically backed up to the cloud.

Final Words#

Here, I want to explain that after purchasing the Alibaba Cloud OSS resource package, you still need to pay for the upload and download traffic. Object Storage OSS Resource Package (Monthly) Pricing Details

So remember to recharge your Alibaba Cloud account with some money. For notes, the traffic generally won't be used much, and it may not exceed six yuan in a year, but if you owe for a long time, your account may be reclaimed (you will receive a reminder for overdue payment, and the overdue limit is generally 10 yuan). So, for safety, it's better to recharge your Alibaba Cloud account with 5 yuan.

Paying brings a better experience. The synchronization speed of Alibaba Cloud OSS is really fast and smooth.

Important things should always follow the "three backups" principle. Here, we have one local backup, one compressed file backup, and one backup in the cloud, following this principle. No matter when,
Remember to backup!! Remember to backup!! Remember to backup!!

Postscript#

If you encounter errors like ! Unable to create __rar_6064.48318 Access is denied., you can check Run with highest privileges for the corresponding task in the Task Scheduler.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.