# How to backup data on a remote computer
Materials: https://mad.oxli.org/t/82
---
## Some backup rules
- "One backup? zero backups."
- A backup is no good if you can't restore it
- Try to have backups in different physical locations
- "I have two backups, one in each hard drive. Both are in my office" ❌
---
## What to backup?
- Your personal computer: EVERYTHING, FREQUENTLY
- buy an extra drive, set up time capsule on mac
- (not sure about windows options...)
- I use [restic](https://restic.net/)
----
- In a project:
- ✔️ raw data
- ❗ intermediate data
- how long did it take to generate?
- how large it is?
- ✔️ results
---
## Backup options
- code? git is built for it.
- data:
- AWS S3 and Glacier
- Backblaze
- Dropbox
- ...
----
- "What does UC Davis offer for cloud storage?"
https://ucdavisit.service-now.com/servicehub/?id=ucd_kb_article&sys_id=3f20e2b56f712d40bc4f8a20af3ee4b2
---
## Today: rclone (https://rclone.org)
----
## Farm login
- [Be a good citizen](https://twitter.com/PicardTips/status/1188562183182962689)! Farm asks to do file transfer in another node
```bash
ssh -p 2022 irber@farm.cse.ucdavis.edu
```
- rclone is a module! `module load rclone`
----
- easy to install (single binary):
```bash
$ wget https://github.com/rclone/rclone/releases/download/v1.50.1/rclone-v1.50.1-linux-amd64.zip
$ unzip rclone-v1.50.1-linux-amd64.zip
$ cp rclone-v1.50.1-linux-amd64/rclone bin/
```
(replace `linux` with `osx` or `windows`)
Versions: https://github.com/rclone/rclone/releases
----
- ~~but you can also install with conda: `conda install rclone`~~ :angry:
- (will open a pull request later to create a conda package...)
---
# Configuring rclone
- (many, many options...)
- `rclone config`
- we will use box: https://rclone.org/box/
<!--
- we will use google drive: https://rclone.org/drive/
- (Highly recommended: https://rclone.org/drive/#making-your-own-client-id)
- `scope`: 3 ("drive.file")
- `root_folder_id`: projects
- `Use auto config?` N
- Click on link, log in to google, copy verification code, paste at terminal
- `Configure this as a team drive`? Not today, but useful
-
-->
----
```
Storage> 6 (this number might change!)
client_id> (empty)
client_secret> (empty)
box_config_file> (empty)
box_sub_type> 1 (user)
Edit advanced config? N
Use auto config? N
```
- At this point we need access to a computer with a browser.
----
- On a computer with a browser:
```bash
$ rclone authorize box
```
- Copy `result>`
----
## Using rclone
```
rclone lsd box:
rclone copy local_file box:
rclone sync -P ncbi/ box:ncbi/
rclone delete box:ncbi/
rclone purge box:ncbi/
```
---
Thanks!
<!--
## Links
- Faster transfers from SLIMS https://bioinformatics.ucdavis.edu/research-computing/documentation/archiving-slims-data/#rsync_.2B_ssh_public_key
- How to transfer large amounts of data via network. http://moo.nac.uci.edu/~hjm/HOWTO_move_data.html
-->
{"metaMigratedAt":"2023-06-15T01:37:27.613Z","metaMigratedFrom":"YAML","title":"How to backup data on a remote computer","breaks":true,"description":"View the slide with \"Slide Mode\".","contributors":"[{\"id\":\"d301df22-ff35-405b-a631-6f3ee9e76bdb\",\"add\":3405,\"del\":2695}]"}