Restore a cPanel Account from a JetBackup Snapshot Using CLI
This guide explains how to restore a cPanel account from a JetBackup snapshot located on a remote backup server when the standard JetBackup GUI restore is not available.
This method is typically used during:
-
Server migrations
-
Disaster recovery
-
Restoring from a dedicated backup server
Prerequisites
Before starting, ensure the following requirements are met:
-
Root SSH access to the destination server
-
JetBackup 5 installed on the destination server
-
Access to the backup server containing the snapshot
-
The full path to the snapshot directory (for example:
snap.3)
Step 1: Prepare and Transfer the Backup Package
JetBackup CLI restores accounts using a compressed backup package (.tar.gz) with a specific directory structure.
1. On the Backup Server
Navigate to the snapshot directory and package the contents.
cd /path/to/snap.3/
mkdir backup
cp -av * backup/
tar -czvf jetbackup5-restore.tar.gz backup/
This will generate:
jetbackup5-restore.tar.gz
2. Transfer the Package to the New Server
Use SCP to copy the package from the backup server.
scp root@BACKUP_IP:/path/to/snap.3/jetbackup5-restore.tar.gz /home/
Replace:
-
BACKUP_IPwith the IP address of your backup server -
/path/to/snap.3/with the actual snapshot path
After completion, the file will be located at:
/home/jetbackup5-restore.tar.gz
Step 2: Execute the JetBackup CLI Restore
1. Start the Restore Process
Run the JetBackup restore command:
jetbackup5 --restorepkg /home/jetbackup5-restore.tar.gz
JetBackup will create a restore job in the queue and display a log file path.
Example:
Log File:
/usr/local/jetapps/var/log/jetbackup5/queue/2_cli/123456789.log
2. Monitor the Restore Progress
Use the tail command to watch the restore process in real time:
tail -f /usr/local/jetapps/var/log/jetbackup5/queue/2_cli/123456789.log
Once completed, the log will indicate the restore has finished successfully.
Step 3: Cleanup
After confirming the website and services are working properly, remove the backup package to free disk space.
rm -f /home/jetbackup5-restore.tar.gz