# Back up with rsync, BorgBackup and restic
Source: https://docs.infraista.com/en/data-storage/backup-storage/back-up-with-rsync-borg-and-restic



Storage boxes work with the backup tools you already use. Set up an [SSH key](/en/data-storage/backup-storage/connect-to-a-storage-box#sign-in-with-an-ssh-key)
first so scheduled runs don't need a password.

In the examples, replace `u100001` and `sb100001.backup.infraista.cloud` with your username and host. The
box's **Access & protocols** tab shows the same commands with your values filled in.

## rsync [#rsync]

rsync sends only the files that changed. It runs over SSH on **port 23**; turn on **rsync over SSH** on
**Access & protocols**.

```bash
rsync -avz --progress -e 'ssh -p 23' ./projects/ u100001@sb100001.backup.infraista.cloud:projects/
```

Add `--delete` to mirror deletions too.

## BorgBackup [#borgbackup]

BorgBackup makes deduplicated, encrypted, versioned backups. It uses the same SSH service as rsync, so the
**rsync over SSH** switch turns it on.

Create the repository once:

```bash
borg init --encryption=repokey ssh://u100001@sb100001.backup.infraista.cloud:23/./borg/main
```

Then back up on a schedule (cron or a systemd timer):

```bash
borg create --stats ssh://u100001@sb100001.backup.infraista.cloud:23/./borg/main::{hostname}-{now} ~/projects
```

<Callout type="warn">
  Keep the repokey passphrase safe. Without it, the backups can't be read, by you or by
  us.
</Callout>

## restic [#restic]

restic makes encrypted, deduplicated backups over SFTP, so it works on every plan whenever **SFTP** is on.

```bash
export RESTIC_REPOSITORY=sftp:u100001@sb100001.backup.infraista.cloud:/restic/main
restic init          # once
restic backup ~/projects
```

For scheduled runs, keep the repository password in a file or a secret manager (for example with
`RESTIC_PASSWORD_FILE`). If your box's SFTP port isn't 22, the Access & protocols tab shows the extra
option to add.

## Check your backups [#check-your-backups]

* The box's **Overview** shows how much is stored and a 30-day chart of stored data.
* [Snapshots](/en/data-storage/backup-storage/snapshots-and-restores) keep point-in-time copies of the
  whole box, including your Borg and restic repositories.

## Related [#related]

* [Snapshots and restores](/en/data-storage/backup-storage/snapshots-and-restores)
