Backup & Recovery

Complete data protection and disaster recovery procedures

TinyBox Automatic Backup System

✓ Automatic Protection Enabled

Your TinyBox VPS is automatically backed up daily with no configuration required. All backups are encrypted and stored securely.

TINY 1.0 VPS Backups

  • Frequency: Daily at 2 AM UTC
  • Retention: 3 backups (7 days)
  • Manual snapshots: 5 maximum
  • Compression: Automatic
  • Encryption: AES-256

TINY 2.1 VPS Backups

  • Frequency: Daily at 2 AM UTC
  • Retention: 5 backups (14 days)
  • Manual snapshots: 10 maximum
  • Compression: Advanced algorithms
  • Encryption: AES-256

Managing Backups via Control Panel

1

Access Backup Section

Login to panel.tinybox.sh and navigate to "Backups & Snapshots"

2

View Available Backups

See all automatic and manual backups with timestamps, sizes, and descriptions

3

Create Manual Snapshot

Click "Create Snapshot" to take an immediate backup before system changes

4

Restore from Backup

Select any backup and click "Restore" for one-click recovery

Restoration Process

  • • Restoration typically takes 5-15 minutes depending on data size
  • • Your VPS will be temporarily offline during restoration
  • • All data is verified for integrity after restoration
  • • You'll receive an email notification when complete

Manual Backup Scripts

Complete System Backup Script

#!/bin/bash
# TinyBox VPS Manual Backup Script
# Save as: /usr/local/bin/backup-system.sh

BACKUP_DIR="/home/backups"
DATE=$(date +%Y%m%d_%H%M%S)
HOSTNAME=$(hostname)

# Create backup directory
mkdir -p $BACKUP_DIR

echo "🔄 Starting TinyBox VPS backup..."

# System configuration backup
echo "📋 Backing up system configuration..."
tar -czf $BACKUP_DIR/system_config_$DATE.tar.gz \
    /etc \
    /root/.ssh \
    /usr/local/bin \
    --exclude=/etc/ssl/private 2>/dev/null

# Web files backup
if [ -d "/var/www" ]; then
    echo "🌐 Backing up web files..."
    tar -czf $BACKUP_DIR/www_files_$DATE.tar.gz /var/www 2>/dev/null
fi

# Database backup (MySQL)
if systemctl is-active --quiet mysql; then
    echo "🗄️ Backing up MySQL databases..."
    mysqldump --all-databases --routines --triggers > $BACKUP_DIR/mysql_all_$DATE.sql
    gzip $BACKUP_DIR/mysql_all_$DATE.sql
fi

# Database backup (PostgreSQL)
if systemctl is-active --quiet postgresql; then
    echo "🐘 Backing up PostgreSQL databases..."
    sudo -u postgres pg_dumpall > $BACKUP_DIR/postgresql_all_$DATE.sql
    gzip $BACKUP_DIR/postgresql_all_$DATE.sql
fi

# User home directories
echo "🏠 Backing up home directories..."
tar -czf $BACKUP_DIR/home_dirs_$DATE.tar.gz /home --exclude=/home/backups 2>/dev/null

# Create manifest file
echo "📄 Creating backup manifest..."
cat > $BACKUP_DIR/backup_manifest_$DATE.txt << EOF
TinyBox VPS Backup Manifest
===========================
Hostname: $HOSTNAME
Date: $(date)
Backup Location: $BACKUP_DIR

Files in this backup:
$(ls -la $BACKUP_DIR/*$DATE*)

System Info:
$(uname -a)
$(df -h)
$(free -h)
EOF

# Cleanup old backups (keep last 5)
echo "🧹 Cleaning up old backups..."
cd $BACKUP_DIR
ls -t backup_manifest_*.txt | tail -n +6 | while read file; do
    DATE_OLD=$(echo $file | sed 's/backup_manifest_//;s/.txt//')
    rm -f *$DATE_OLD*
done

echo "✅ Backup completed: $BACKUP_DIR"
echo "📊 Backup size: $(du -sh $BACKUP_DIR | cut -f1)"

# Make executable: chmod +x /usr/local/bin/backup-system.sh

Database-Only Backup

#!/bin/bash
# Database backup script
BACKUP_DIR="/home/db_backups"
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p $BACKUP_DIR

# MySQL backup
if systemctl is-active --quiet mysql; then
    echo "Backing up MySQL..."
    mysqldump --all-databases --single-transaction --routines --triggers > $BACKUP_DIR/mysql_$DATE.sql
    gzip $BACKUP_DIR/mysql_$DATE.sql
fi

# PostgreSQL backup  
if systemctl is-active --quiet postgresql; then
    echo "Backing up PostgreSQL..."
    sudo -u postgres pg_dumpall > $BACKUP_DIR/postgresql_$DATE.sql
    gzip $BACKUP_DIR/postgresql_$DATE.sql
fi

echo "Database backup completed: $BACKUP_DIR"

Recovery Procedures

⚠️ Before You Begin Recovery

  • • Stop all running services that might write to disk
  • • Ensure you have enough disk space for restoration
  • • Document the issue before starting recovery
  • • Consider creating a snapshot of current state first

Control Panel Recovery (Recommended)

  1. 1. Access TinyBox Control Panel
  2. 2. Navigate to "Backups & Snapshots"
  3. 3. Select the backup you want to restore from
  4. 4. Click "Restore" and confirm the action
  5. 5. Wait for email notification of completion
  6. 6. Test system functionality after restoration

Manual File Recovery

# Restore from manual backup
BACKUP_DIR="/home/backups"
RESTORE_DATE="20240115_140330"  # Replace with your backup date

# Restore system config (be careful!)
sudo tar -xzf $BACKUP_DIR/system_config_$RESTORE_DATE.tar.gz -C /

# Restore web files
sudo tar -xzf $BACKUP_DIR/www_files_$RESTORE_DATE.tar.gz -C /

# Restore databases (MySQL)
gunzip < $BACKUP_DIR/mysql_all_$RESTORE_DATE.sql.gz | mysql

# Restore databases (PostgreSQL)
sudo -u postgres psql < $BACKUP_DIR/postgresql_all_$RESTORE_DATE.sql

# Restore permissions
chown -R www-data:www-data /var/www
systemctl restart nginx apache2 mysql postgresql

Selective File Recovery

# Extract specific files from backup
tar -tzf backup.tar.gz | grep "filename"  # Find files
tar -xzf backup.tar.gz path/to/specific/file

# Restore single database
gunzip < mysql_backup.sql.gz | mysql database_name

# Restore specific directory
tar -xzf www_files.tar.gz var/www/specific_site

Disaster Recovery Plan

✓ Prevention Checklist

  • • Automated daily backups enabled
  • • Manual snapshots before updates
  • • Regular backup testing (monthly)
  • • Off-site backup copies for critical data
  • • Documentation of restore procedures
  • • Recovery time objectives defined
  • • Emergency contact information ready

🆘 Emergency Response

  1. 1. Assess the situation - What data is affected?
  2. 2. Contact TinyBox Support - Email [email protected]
  3. 3. Use Control Panel - Try web console access
  4. 4. Restore from backup - Use most recent clean backup
  5. 5. Verify restoration - Test all critical functionality
  6. 6. Document incident - Record what happened and how it was fixed

🚨 When to Contact Support Immediately

  • • Complete server failure or corruption
  • • Backup restoration fails via control panel
  • • Suspected security breach or data compromise
  • • Hardware failure indicated by control panel
  • • Need for off-site backup restoration

Emergency Support: [email protected]
Response Time: Usually within 24 hours, prioritized for disasters