banner
Wayne

Wayne

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

My Obsidian synchronization + backup plan

Overview of Synchronization Solution#

I have been using Obsidian for two years, and for the multi-device synchronization of Obsidian, I have finally adopted the following synchronization and backup solutions:

  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 had been using 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). Then I used the Koofr tool to generate OneDrive's webdav service. 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. Then I looked at the .git folder, oh my, it's over 1GB. I'm not a programmer, so I dare not delete it randomly. If I keep the current situation, I will have to copy the entire directory for seamless backup during the next system migration. Also, I found that pushing to git 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, my notes are back, and the configuration is intact.

Implementation of the Solution#

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 the monthly traffic was 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 are also available) 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), which 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, click on the Bucket List on the left side, and create a Bucket with any name. Choose the region closest to you, and ignore the rest.

After creating the Bucket, enter the Bucket and click on Data Security and then Cross-origin Settings. Create a rule with the following Source:

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

Check all Allowed Methods, and in Allowed Headers, enter: *. After completing the configuration, 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 shows like this, click on Start using sub-user AccessKey.
image

Then, you will be taken to the user management page. Create a user with any login name and display name. Here, I set it to be the same as the Bucket name 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, and then select the user you just created. Check Full Control for Authorized Operation, and ignore the rest. 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 that 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

If you encounter an issue during the synchronization process where you cannot access the corresponding storage bucket due to an incorrect region, you can change the region to ap-east-1. According to the official documentation, this corresponds to the Hong Kong region in the Asia-Pacific region.

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 Sync every 5 minutes and Sync 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 my computer, I use WinRAR to compress the entire Obsidian folder and back it up to the D:\Backups directory (which is synchronized with my Google Drive). The specific steps are as follows:

Press win+R, enter taskschd.msc, and press Enter. Click on Create Basic Task on the right side. 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. 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. Fill in the optional parameters as follows:

a -r -bb1 -bd "parameter1" "parameter2"

Parameter 1 specifies the path and filename 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 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 me to choose the backup directory freely, and the speed is good (of course, it requires a proxy). You can also write parameter 1 as the path of your OneDrive (iCloud for Mac), so it can be automatically backed up to the cloud.

Final Words#

Here, I want to clarify that if you purchase the Alibaba Cloud OSS resource package, you will also 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 6 yuan in a year, but if you owe for a long time, your resources may be reclaimed (you will receive a reminder for overdue payment, and the overdue limit is generally 10 yuan), so it's better to recharge your Alibaba Cloud account with 5 yuan just to be safe.

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 cloud backup. Remember to backup no matter when!
Remember to backup!! Remember to backup!! Remember to backup!!

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