Hostwinds Tutorials

Search results for:


Mounting Restic Backups to a Linux Server

Tags: VPS,  Linux,  Restic 

With Linux (unfortunately, this feature is not available for Windows), you can mount your restic repo to a location of your choice to navigate ALL of your snapshots in a directory tree.

As with any interaction with Restic, you must first initialize the repo to perform actions within restic.

You may need to install fuse if it is not installed already. To do so, run the following commands  -

CentOS

yum install fuse

Ubuntu

apt-get install fuse

Fedora

yum install fuse

Debian

apt-get install fuse

To mount your restic repo, create a mount point of your choosing. In this example, we will use /mnt/backups.

# mkdir /mnt/backups

# restic mount /mnt/backups
password is correct
Now serving the repository at /mnt/backups
Don't forget to umount after quitting!

After running this, the process will remain running until you cancel it (ctrl + c), so you'll need to open another terminal or FTP client to browse your backups.

Using the above example's mount point, your backups (snapshots) are located in /mnt/backups/snapshots.

# ll
total 0
dr-xr-xr-x 11 root root 0 Feb 22 12:59 2018-02-22T12:59:30-08:00
dr-xr-xr-x 3 root root 0 Feb 22 13:17 2018-02-22T13:17:17-08:00
dr-xr-xr-x 3 root root 0 Feb 22 13:17 2018-02-22T13:17:20-08:00
dr-xr-xr-x 3 root root 0 Feb 22 13:17 2018-02-22T13:17:28-08:00
lrwxrwxrwx 1 root root 0 Feb 22 13:17 latest -> 2018-02-22T13:17:28-08:00

Each snapshot is labeled with a date and time stamp, and your latest backup is in a symlink folder labeled latest.

These files are read-only, meaning that you cannot move or edit them. However, you can copy them.

Navigate the folders as you would within your own filesystem and locate the files you wish to restore. You can use the copy command in Linux to copy the file(s) or folder(s) you wish to restore. You can then specify the location you wish to restore them to, or if you wish, you can do so to their original location. The choice is completely up to you.

The command syntax to copy a file or folder would be as follows -

cp filename filepath/filename

i.e.:

cp testfile.txt /root/txtfile.txt

You can copy more than one file or folder through the following command

cp -R myDirectory/ /root/mydirectory

Once you're finished, you can cancel the mount command you ran in the original terminal window.

Written by Hostwinds Team  /  June 5, 2021