brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: borg mount lets you browse an archive like a normal folder

Backup
~/tips/tip-backup-borg-mount

borg mount /path/to/repo /mnt/borg

Mounts a Borg repository or archive as a filesystem so you can copy files out.

Extracting a single file from a backup shouldn’t mean remembering a long extract command. Mounting the repository gives me a folder to click through.

borg mount /path/to/repo /mnt/borg
borg umount /mnt/borg

It uses FUSE, so you need that set up on the machine. The first argument can be the whole repository or a single archive. The docs advise mounting a specific archive or path, because a whole-repository mount loads the archive directories on demand and that can be slow.

The process runs in the background until you unmount. With -f (--foreground) it stays in the foreground, and Ctrl+C unmounts it cleanly. A daemonized mount does not unmount itself on signals or a crash, and its output goes to /dev/null.

Two more caveats from the docs: Borg stores symlinks as they are, so a link can point outside the mount point, and restoring through the mount doesn’t support ACLs or special filesystem flags. The -o versions view across archives is marked experimental.

You can also narrow what shows up. --first N and --last N keep only that many archives, and -a (--glob-archives) filters on a name pattern. --strip-components NUMBER removes leading path elements, and paths with fewer elements are silently skipped.

If a link inside the mount looks suspicious, the docs say that on Linux remounting with nosymfollow stops symlinks from resolving outside the mount point.

Further reading: borg mount

More Backup tips restic snapshots --group-by host,paths mysqldump --routines --events mydb > mydb.sql rsync -a --files-from=list.txt /home/me/ backup:/backup/ restic find "*.txt" restic stats All Backup tips (45) All topics

Link