Backup¶
Danger
Users are responsible to backup their files and data. There is no backup of ScienceCluster data by default.
Introduction¶
This page describes how to connect and backup your ScienceCluster data to a NAS device, for example the UZH NAS service. (NAS stands for Network Attached Storage.)
You can use smbclient
to connect to a NAS and then explore the file system and download or upload files to ScienceCluster file system.
Additionally, you can use Rclone to copy and sync to a NAS, which can act as a backup or mirror of your ScienceCluster files.
Info
Please note that smbclient
and rclone
do not mount a NAS on the ScienceCluster. This is why tools like restic
will not work.
Connect with smbclient
¶
Hint
It's helpful to debug your NAS connection with smbclient
before using those connection parameters with rclone
.
Establish a connection¶
To connect to a UZH NAS, input the following command:
smbclient --max-protocol SMB3 -W UZH -U username //nasaddress
and replace username
with your UZH shortname and nasaddress
with the address to your NAS. If the command is correct and the NAS is working properly, you will be prompted to enter your password.
NAS addresses are often shared with a shared folder path. For example, smb://examplenas.uzh.ch/subfolder$
. In this case, you would input the following into the smbclient
command:
smbclient --max-protocol SMB3 -W UZH -U username //nasaddress/subfolder$
Once you have successfully connected to the NAS, you will see the following prompt in your terminal:
smb: \>
Type exit
to leave the prompt.
Commands¶
To send a single large file to a NAS, use a command like this:
smbclient --max-protocol SMB3 -W UZH -U username //nasaddress/backups -c "put backup.tar.gz"
In addition to put
, other commands include ls
, cd
and get
. For a full list of commands, run man smbclient
and look under the "Operations" section.
Backup with Rclone¶
Rclone can be used to back up data using the same connection details you would use with smbclient.
Hint
On the ScienceCluster, use module load rclone
before starting.
Configuration¶
Create or update your Rclone configuration file by running the command rclone config
. You can then check the connecting settings by using ~/.config/rclone/rclone.conf
, or in some cases editing this file directly if needed.
Your rclone.conf
file should have an entry that looks like this:
[my-nas]
type = smb
host = <nasaddress>
user = <username>
pass = <encrypted, redacted>
domain = <domain>
Running copy
¶
The copy
command only transfers new or updated files; no deletions are made on the remote.
rclone copy mydata/ my-nas:my-share$/mybackups --progress
Running sync
¶
The sync
command makes the destination exactly match the source. Files on the remote that are not present in the source will be deleted.
rclone sync mydata/ my-nas:my-share$/mybackups --progress
You can safely test these commands without making any changes by adding the --dry-run
flag:
rclone sync mydata/ my-nas:my-share$/mybackups --dry-run --progress
This will show what would be transferred or deleted without actually performing the operation.