Snapshots and Backups

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

02

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:

How to create a 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.

  • Before critical system updates
  • Before installing new software
  • Before configuration changes
  • Log into the control panel
  • Select your server
  • Go to Snapshots or Backups
  • Click Create Snapshot
03

Manual file backup with `rsync`

To backup your files to a remote server or locally:

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

Example: backup /var/www folder:

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

Automatic backup with cron

To schedule a daily backup:

bash
crontab -e

Add:

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

MySQL/MariaDB database backup

bash
# 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:

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

Restore from database backup

bash
# 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
07

Backup with BorgBackup (advanced solution)

BorgBackup is a professional tool with deduplication and encryption:

bash
# 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

DeluxHost, fondata nel 2023, offre soluzioni di hosting di alta qualità per diverse esigenze digitali. Forniamo hosting condiviso, VPS e server dedicati con sicurezza avanzata e datacenter globali.

© DeluxHost, Tutti i diritti riservati. | Partita IVA: IT17734661006
Tutti i sistemi operativi