๐Ÿงฉ Restoring cPanel Accounts on a New Server (CloudLinux)

This guide shows how to restore cPanel accounts from a backup directory (e.g., /backup/2024-01-01/accounts/) on a new server running cPanel and CloudLinux.


๐Ÿ“‚ Prerequisites

  • Root SSH access to the new server
  • Backup directory exists: /backup/2024-01-01/accounts/
  • cPanel and CloudLinux are installed and licensed
  • Sufficient disk space and inode limits

โœ… Step-by-Step Account Restore

๐Ÿ”น 1. Define Restore Parameters

RESTORE_FROM_DATE="2024-01-01"
BACKUP_TYPE="daily"

if [ "$BACKUP_TYPE" = "daily" ]; then
    BACKUP_BASE="/backup/$RESTORE_FROM_DATE/accounts/"
else
    BACKUP_BASE="/backup/$BACKUP_TYPE/$RESTORE_FROM_DATE/accounts/"
fi

๐Ÿ”น 2. Start Batch Restore

for CP_ACC in $(find "$BACKUP_BASE" -maxdepth 1 -type d | awk -F/ '{print $5}' | sed 's/.tar.gz//g'); do
    /usr/local/cpanel/bin/backup_restore_manager add user="$CP_ACC" restore_point="$RESTORE_FROM_DATE" mail_config=1 mysql=1 subdomains=1
done

โœ… This uses the native backup_restore_manager tool for structured and reliable account recovery.


๐Ÿ” Manual Restore (For .tar.gz Archives)

If your backups are in .tar.gz format:

cd /backup/2024-01-01/accounts
for archive in *.tar.gz; do
    /scripts/restorepkg "$archive"
done

โš ๏ธ Disk & Inode Considerations

For large accounts (e.g., examplefashionco โ€“ 50GB+, 500k+ inodes):

  • Use a dedicated VPS or cloud instance
  • Minimum 100GB SSD storage
  • High inode support
  • 2GB+ RAM recommended

๐ŸŒ Transferring Backups from the Old Server

Use rsync to copy from the old server:

rsync -avR --progress -e "ssh -p 5222" ./2024-01-01 root@192.0.2.10:/home

(Replace IP, port, and path with your actual server details.)


โœ… Post-Restore Checklist

  • Confirm websites load correctly
  • Verify DNS zones
  • Test email delivery and settings
  • Check database connections
  • Fix file/folder ownerships if needed
  • Assign correct PHP version per user
Scroll to Top