Server Management

Snapshots and Backups

How to protect your server data with snapshots and backups

There are two levels of protection: snapshots (instant copy of the entire server) and backups (copy of individual files or databases).


Snapshots from panel

Snapshots are complete copies of your server's disk at a specific point in time. They allow you to restore your server to a previous state in just a few minutes.

When to use a snapshot:

  • Before critical system updates
  • Before installing new software
  • Before configuration changes

How to create a snapshot:

  1. Log into the control panel
  2. Select your server
  3. Go to Snapshots or Backups
  4. Click Create Snapshot

Snapshots take up space in your plan. Check the maximum number of snapshots available for your plan and delete old ones when no longer needed.


Manual file backup with rsync

To backup your files to a remote server or locally:

rsync -avz --progress /path/to/backup/ user@backup-server:/destination/path/

Example: backup /var/www folder:

rsync -avz /var/www/ backup@192.168.1.100:/backups/www/

Automatic backup with cron

To schedule a daily backup:

crontab -e

Add:

# Daily backup at 03:00
0 3 * * * rsync -az /var/www/ backup@IP_BACKUP:/backups/www/ >> /var/log/backup.log 2>&1

MySQL/MariaDB database backup

# Backup all databases
mysqldump --all-databases -u root -p > /root/backup_db_$(date +%Y%m%d).sql

# Backup a single database
mysqldump -u root -p database_name > /root/backup_database_$(date +%Y%m%d).sql

To compress the backup:

mysqldump -u root -p database_name | gzip > /root/backup_$(date +%Y%m%d).sql.gz

Restore from database backup

# From .sql file
mysql -u root -p database_name < /root/backup.sql

# From .sql.gz file
gunzip < /root/backup.sql.gz | mysql -u root -p database_name

Backup with BorgBackup (advanced solution)

BorgBackup is a professional tool with deduplication and encryption:

# Installation
apt install borgbackup

# Initialize the repository
borg init --encryption=repokey user@backup-server:/backups/borg

# Create a backup
borg create user@backup-server:/backups/borg::$(date +%Y-%m-%d) /var/www /etc

# List of backups
borg list user@backup-server:/backups/borg

On this page