Encrypted (Automated) Backups

I wanted to share this tip with you, because I think it’s a pretty easy-to-setup and secure way to backup your files in the cloud. Would be cool if (something like) this became an Obsidian feature or plugin:

I currently have my Vault on my local filesystem, and created a small bash script that does the following thing each day:

  • Compress vault to 7z, use 7zip’s encryption with a password
  • Copy file to cloud storage, (filename year-month-day.7z)

Since I don’t use many images in my notes, the storage size required by these daily backups remains small. However, if my vault size grows too big for storing months of daily backups copies, I can imagine that I implement the following rule:

  • Store a daily note for each day of the past week.
  • For weeks preceding the past week: Delete all backups from that week, except for the final backup of that week.
  • For the months preceding the past month, only store the final backup of that month.

If anyone reading this wants to implement this by themselves, creating a backup from the command line is pretty straightforward. Note that this does store your password visibly on your local filesystem, be aware of this:

7z a -pPASSWORD $(date "+%Y%m%d".7z) PATH-TO-FOLDER

Just replace PASSWORD and PATH-TO-FOLDER with yours. You’ll have to create the rest of this script (copying the 7z) and scheduling the execution with automator by yourself, but that’s also pretty straightforward.

8 Likes

Hi Tom,

Do you think this post belong to “Share & Showcase”? I don’t see any plugins to be implemented here :slight_smile:.

Let me know if I should move it.

Could be moved there, but I posted it here as I thought that it would be a cool plugin to have; a time-machine like plugin for storing encrypted backups on a cloud storage of choice. Sorry that I didn’t point that out clear enough.

1 Like

I see, I think I got confused by the instructions. I’ll leave it here then, thanks for the clarification!

This is great, I’ve never thought about automated backups until I saw your post, but this is a pretty nice way to streamline this process. Just wanted to add a couple of ideas, in case anyone is interested in setting this up too:

  • For me, the timestamp file name in the command doesn’t work. EDIT: I just realized you’re probably on Mac or Linux. I already found the right date variable to make this work on Windows’ command prompt.
  • If you care about security and privacy, I’d suggest adding the -mhe switch to the command. This will also encrypt the file estructure of the .7z, so nobody can’t even see the filenames of the notes in your vault without first entering the password.
1 Like

Other backup plugin options to include/exclude:

  • Trash
  • File attachments (assuming they are in one folder specified by settings)
  • Settings
  • Selected folders

With additional settings for scheduling, you could decide to do full backups on a certain schedule and partial backups more frequently.

1 Like

Thanks!