# Create a file backup of a DigitalOcean Spaces bucket

Mount a DigitalOcean Space as a local filesystem and back it up with SimpleBackups.

DigitalOcean Spaces is an S3-compatible object storage service. By mounting a Space on your server using `s3fs-fuse`, you can treat it as a regular directory and back it up as a file backup with SimpleBackups. This guide covers mounting, credential management, boot automation, and backup configuration.

## Prerequisites

- **Ubuntu VPS** running Ubuntu or a compatible distribution
- **DigitalOcean Space** with its Access Key and Secret Key
- **Root or sudo access** on your server
- **SimpleBackups account** — [sign up](https://simplebackups.com/) if you do not have one

## Install s3fs-fuse

`s3fs-fuse` lets you mount S3-compatible storage as a local filesystem.

```bash
sudo apt update
```

```bash
sudo apt install s3fs
```

## Store your credentials

Create a directory for secrets and save your DigitalOcean Spaces credentials:

```bash
mkdir ~/.secrets
```

```bash
echo "ACCESS_KEY_ID:SECRET_ACCESS_KEY" > ~/.secrets/dospace-credentials
```

Replace `ACCESS_KEY_ID` and `SECRET_ACCESS_KEY` with your actual credentials. Then restrict the file permissions:

```bash
chmod 600 ~/.secrets/dospace-credentials
```

## Mount the Space

Create a mount point and mount your Space:

```bash
sudo mkdir /mnt/dospace
```

```bash
s3fs YOUR_SPACE_NAME /mnt/dospace -o passwd_file=~/.secrets/dospace-credentials -o url=https://YOUR_REGION.digitaloceanspaces.com -o use_path_request_style
```

Replace `YOUR_SPACE_NAME` with the name of your Space and `YOUR_REGION` with the region code (for example, `nyc3`).

Verify the mount by checking the filesystem and listing the contents:

```bash
df -h
```

```bash
ls /mnt/dospace
```

You should see the contents of your DigitalOcean Space.

## Automate mounting at boot

To ensure the Space mounts automatically after a reboot, add an entry to `/etc/fstab`:

```bash
sudo nano /etc/fstab
```

Add the following line:

```bash
s3fs#YOUR_SPACE_NAME /mnt/dospace fuse _netdev,passwd_file=/home/your_username/.secrets/dospace-credentials,url=https://YOUR_REGION.digitaloceanspaces.com,use_path_request_style 0 0
```

Replace `your_username` with your actual username. Test the configuration:

```bash
sudo mount -a
```

Check for any errors and verify the mount as described above.

## Set up the backup in SimpleBackups

With your Space mounted as a local directory, you can configure a file backup in SimpleBackups:

1. Log in to your [SimpleBackups dashboard](https://my.simplebackups.com/)
2. Navigate to **Servers** and click **Connect Server**. Use the **Automatic (SSH Key)** method and follow the instructions to connect your VPS
3. Click **Create Backup** and select **File Backup**
4. Select the server you connected and enter the directories you want to back up (for example, `/mnt/dospace` or specific subdirectories within it)
5. Choose your storage destination — you can use SimpleStorage or any connected storage provider
6. Set your schedule and retention policy
7. Review your settings and click **Save** to enable the backup

**Credential security:**
Store your credentials with restricted file permissions (`chmod 600`) and consider rotating your Access and Secret Keys periodically. For enhanced security, you can use secrets management tools like HashiCorp Vault or the AWS CLI credentials file.

- [Create a file/server backup](https://simplebackups.com/docs/server-and-file-backup/create-a-fileserver-backup): General guide to creating file and server backups.

- [Backup storage](https://simplebackups.com/docs/getting-started/features/backup-storage): Learn about the storage options available for your backups.
