Using Borg to backup data

In this example we use:

  • Borg over SSH to set up remote repo.
  • SSH keys to login.


Install Borg on Debian and Ubuntu based Linux.

sudo apt install borgbackup

Install Borg on other Systems.

Go to https://www.borgbackup.org/releases/

Set up remote repo.

1. Initialize a repository on remote host.

borg init -e repokey user118@


2. Backup the ~/disks and ~/folder directories into an archive called first.

borg create -v --stats user118@ ~/disks ~/folder

create 1

create 2

3. List all archives in the repository.

borg list user118@


4. List contents of archive named third.

borg list user118@


5. Restore the third archive to current directory.

borg extract user118@


6. Delete the third archive.

borg delete user118@


Note that this does not free repo disk space.

7. Recover disk space by compacting the segment files in the repo.

ssh user118@ borg compact /home/user118/repo
borg delete user118@


If it is not possible to install Borg on the remote host, it is still possible to use the remote host to store a repository by mounting the remote filesystem, for example, using sshfs:

This will mount remote directory disks to local directory extra.

sshfs user118@ ~/extra
borg init -e repokey ~/extra/repo
fusermount -u /home/{user}/extra


Borg Quickstart