Mount Borg backups with ease

Borg is an excellent backup software. One of Borg’s features is mounting the backups and accessing all files in them. This is done by running borg mount with the path to the repository and the name of the archive you want to mount.

My workflow for mounting a Borg archive is typically like this:

  • Determine which repository contains the archive I want to mount.
  • cd into it.
  • Run borg list . to list the archives on that repository.
  • Decide for one of those archives.
  • Make an empty directory for the mounting.
  • Tell Borg my passphrase.
  • Mount the archive with borg .::${archive_name} ${mount_path}. This is the most tedious part since we need to type the full archive name and the mount path.
  • cd to the mount point or open my file manager and browse to it.
  • After I’m done, remember to type a command to umount the archive.

It’s easy to see how repeatedly typing those commands can become tedious and frustrating (not to mention error prone).

So I wrote a simple Bash script to automate this task.

The solution

It works like this:

  1. It first lists all your archives.
  2. You select one by simply typing a number.
  3. The archive is mounted and your file manager pops up with it (if you are using a graphical interface).
  4. After you are done, you can just press enter and the archive will be umounted.

So from all that huge list of commands, we came to just type this:

$ borg-mount /repo/path
foobar # type the passphrase
8 # the archive number (if not exported)
↵ # umount when done

Cool, uh?

Downloading and running

You can find the script here. Near the top you’ll find a configuration section with the values to pass to borg mount command. You’ll probably want to change the file manager command and empty the other values before first running it.


Updates

  • : Describe new features added to the script.
  • : Update instructions to run the script.