Hostwinds Tutorials
Search results for:
Table of Contents
Tags: Dedicated Server, VPS, Backups
Cloud Backups for a VPS or Dedicated server use the restic program to provide de-duplicated backups of (most of) the filesystem in the server. When viewed through an Object Storage link or s3 browser, it may look like many randomly numbered directories, but this is the restic 'repo' that organizes the encrypted backups of your data.
You can download the entire backup to another computer or access the files as they are in Object Storage. For either option, you will need to have the restic program on your local computer. You can get it from https://github.com/restic/restic/releases/ (download the appropriate version for your local desktop from the 'assets' section for the latest 0.9.x version). Alternatively, many Linux package managers have restic available: https://restic.readthedocs.io/en/latest/020_installation.html. For Windows installs, it is recommended to rename to restic.exe and copy to the directory you're working from.
Step 1: Download and connect the S3 Browser or a similar tool.
Step 2: Download the 'container' for your backups, which will typically be 'Backup_xxxxxx'. This will take a while, depending on the size of the container.
Unlike the environment within the VPS where Cloud Backups is set up, we must specify the 'repo' location with -r, and manually enter the password. The restic password is in the VPS in the /root/.restic_var or C:\Windows\System32\restic_repo.ps1 file as "RESTIC_PASSWORD". Please contact Tech Support via a support ticket if you can't find it or no longer have access to the server, and we will be happy to assist you.
Step 3: To see snapshots available.
restic snapshots -r /path/to/downloads
./restic.exe snapshots -r C:\path\to\downloads
For example, with the Cloud Backups for a Linux VPS downloaded to a Windows desktop, with restic.exe on the desktop and a 'Backup' folder containing the restic repo:
From there, you can restore backups with restic except for the "initializing the repo" step and remembering to add " -r /path/to/backups" to the commands.
Step 4: To restore the latest backup of the /root/ directory of our Linux VPS to the 'restore' directory on this desktop:
./restic.exe restore latest -r .\Backup\ --include /root --target .\restore\
And we can see the files are now in .\restore\root
Alternatively, you can skip downloading the whole backup and work with the Object Storage in your Hostwinds account as if you were on the server being backed up. To do this, you will need to download or re-create the /root/.restic_var or C:\Windows\System32\restic_repo.ps1 file.
The linux /root/.restic_var file:
export AWS_ACCESS_KEY_ID="....."
export AWS_SECRET_ACCESS_KEY="...."
export RESTIC_REPOSITORY="s3:http://sea-storage.cloud.hostwindsdns.com/....."
export RESTIC_PASSWORD="....."
export BACKUP_RETENTION="60"
The Windows C:\Windows\System32\restic_repo.ps1 file is the same, with $env: at the front instead of export:
$env:AWS_ACCESS_KEY_ID="....."
$env:AWS_SECRET_ACCESS_KEY="...."
$env:RESTIC_REPOSITORY="s3:http://sea-storage.cloud.hostwindsdns.com/....."
$env:RESTIC_PASSWORD="....."
$env:BACKUP_RETENTION="60"
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are your Object API storage keys from the Object API button https://clients.hostwinds.com/cloud/object_storage.php and the RESTIC_REPOSITORY is the API Endpoint from that dialog, with 's3:' in the front and the name of the container after. Note the location of the container for the backup and use the corresponding values in the Object API. The password will be in the corresponding restic file on the VPS. If you cannot find it or do not have access to the server, please contact Tech Support via ticket as we cannot share passwords through LiveChat.
From there, you can initialize on your local computer and then restore files just like you were logged into the server.
You can use the details of a Linux VPS on a Windows desktop and view snapshots, restore data, etc.:
Written by Hostwinds Team / June 5, 2021