To ensure entropy for generating a GPG key, install and run Haveged.
Transferring your data from Dedibox to Elastic Metal
- dedibox
- elastic-metal
- migration
This tutorial provides step-by-step guidance for migrating your existing data from a Dedibox to an Elastic Metal server, ensuring improved stability, performance, and reliability.
We use Duplicity to encrypt the backup and upload it to Object Storage. Then, we download and decrypt the data on the Elastic Metal server.
Before you startLink to this anchor
To complete the actions presented below, you must have:
PrerequisitesLink to this anchor
- A Scaleway account logged into the console
- Owner status or appropriate IAM permissions
- An SSH key
- A Dedibox server
- Created and installed an Elastic Metal server
Creating an Object Storage bucketLink to this anchor
- Log in to the Scaleway console.
- Click Storage on the side menu to view your buckets.
- Click Create a Bucket, enter a unique name (lowercase alphanumeric characters only), and validate.
- Ensure the correct region is selected (e.g.,
s3.fr-par.scw.cloud
,s3.nl-ams.scw.cloud
).
Installing software requirements on the Dedibox ServerLink to this anchor
Run the following commands to update your system and install Duplicity:
apt update && apt upgrade -yapt install -y python3-boto3 python3-pip haveged gettext librsync-dev pipxpython3 -m pip install --upgrade pip
Installing DuplicityLink to this anchor
Choose one of the following installation methods, depending on whether you want to install for all users or just the current user:
Install for all users (recommended)
sudo pipx --global install duplicity
This will install Duplicity in /usr/local/bin/duplicity
and its dependencies in /opt/pipx/venvs/duplicity
.
Install for current user only
pipx install duplicity
This will install Duplicity in ~/.local/bin/duplicity
and its dependencies in ~/.local/pipx/venvs/duplicity
.
For more information, visit the Duplicity GitLab page.
Always check the Duplicity website for the latest version.
Creating a GPG keyLink to this anchor
- Generate the GPG key:
Use default settings:gpg --full-generate-key
- Key type: (1) RSA and RSA (default)
- Key size: 3072
- Expiration: 0 (never expires)
- Assign a name, email, and comment.
- Retrieve the GPG Key fingerprint:
gpg --list-keys
Transferring the GPG key to the Elastic Metal serverLink to this anchor
- Export the GPG private key:
gpg --export-secret-key --armor "your-key-id" > ~/my-key.asc
- Securely transfer the key:
scp ~/my-key.asc root@<elastic-metal>:/root/
Backing up your DediboxLink to this anchor
- Create the necessary files and directories:
touch scw-backup.sh .scw-configrcchmod 700 scw-backup.shchmod 600 .scw-configrcmkdir -p /var/log/duplicitytouch /var/log/duplicity/logfile{.log,-recent.log}
- Add the following configurations to
.scw-configrc
:export AWS_ACCESS_KEY_ID="<SCALEWAY ACCESS KEY>"export AWS_SECRET_ACCESS_KEY="<SCALEWAY SECRET ACCESS KEY>"export SCW_BUCKET="s3://s3.fr-par.scw.cloud/<YOUR BUCKET>"export PASSPHRASE="<YOUR GPG KEY PASSPHRASE>"export GPG_FINGERPRINT="<YOUR GPG KEY FINGERPRINT>"export SOURCE="<PATH TO BACKUP>"export LOGFILE_RECENT="/var/log/duplicity/logfile-recent.log"export LOGFILE="/var/log/duplicity/logfile.log" - Backup script (
scw-backup.sh
):#!/bin/bashsource .scw-configrcduplicity full --encrypt-key=${GPG_FINGERPRINT} ${SOURCE} ${SCW_BUCKET} - Run the backup:
./scw-backup.sh
Restoring data on your Elastic Metal serverLink to this anchor
- Install required packages:
apt update && apt upgrade -yapt install -y python3-boto3 python3-pip gettext librsync-dev pipxpython3 -m pip install --upgrade pipsudo pipx --global install duplicity
- Import the GPG key:
gpg --import ~/my-key.asc
- Restore script (
scw-restore.sh
):#!/bin/bashsource .scw-configrcduplicity restore ${SCW_BUCKET} /destination/folder/ - Execute the restore script:
./scw-restore.sh
Duplicity can also be used for incremental backups. See How to back up your dedicated server on Object Storage with Duplicity for details.