Full Disaster Recovery Guide for cPanel & WHM Servers

This guide provides a complete disaster recovery procedure for cPanel & WHM servers after a hard‑drive crash or system failure. It covers preparation steps, rebuilding the server, provisioning a new drive, recovering data through chroot, backing up accounts and configurations, restoring files to a new system, and validating the recovered server.

cPanel disaster recoveryserver crash restorationcPanel chroot recovery

~3 min read • Updated Feb 18, 2026

1. Overview


Warning: Only experienced system administrators should perform full disaster recovery. WebPros International, LLC does not support failed hard drives or data recovery and is not responsible for data loss.


In cases where your server’s hard drive fails or becomes unbootable, you may need to fully rebuild and restore your cPanel & WHM server.


2. Prepare to Restore Your Server


If you have recent remote backups and cannot boot the failed drive, you can proceed directly to rebuilding the server.


Warning: If you lack recent remote backups, revise your backup strategy to ensure regular off‑server backups.


If the failed drive is still bootable:


  • If WHM is accessible, create a backup via Backup Configuration.
  • If WHM is not accessible, run:
    /usr/local/cpanel/scripts/pkgacct

Transfer all backup files to a remote location before proceeding.


3. Rebuild the Server


Some hosting providers offer automated restoration or imaging. Contact your provider for available options.


Important: The replacement server must use identical software versions—MySQL/MariaDB, PHP, Apache, and extensions. Mismatched versions may cause severe errors.


Perform updates only after the restoration is complete.


4. Manually Provision a New Hard Drive


Important: Only use official OS ISO images. Third‑party images may cause system issues.


Steps:


  1. Install a new primary hard drive and attach the old drive as secondary.
  2. Install the operating system.
  3. Install cPanel & WHM:
    cd /home
    curl -o latest -L https://securedownloads.cpanel.net/latest
    sh latest

5. Request a New Drive and Image


If your provider installs a new drive and attaches the old one as secondary, update cPanel using:


/usr/local/cpanel/scripts/upcp

Or via WHM’s Upgrade to Latest Version interface.


6. Recover Your Files


If you cannot boot the failed drive and lack remote backups, proceed with file recovery.


Steps to recover data using chroot:


6.1 Mount the secondary drive


mkdir /mnt/chroot/
mount /dev/sdb1 /mnt/chroot/

6.2 Bind mount system filesystems


mount --bind /proc /mnt/chroot/proc
mount --rbind /dev /mnt/chroot/dev
mount --bind /sys /mnt/chroot/sys

6.3 Verify mounts


grep chroot /etc/mtab

6.4 Start a tmux session


tmux

6.5 Enter the chroot environment


chroot /mnt/chroot /bin/bash -l
export PS1="{chrooted}$PS1"

6.6 Load environment


source /etc/environment && source /etc/profile

6.7 Start required services


Start MySQL:

/usr/sbin/mysqld --daemonize --user=mysql --pid-file=/var/run/mysqld/mysqld.pid ${MYSQLD_OPTS}

Start dnsadmin:

/usr/local/cpanel/libexec/dnsadmin-startup --start

6.8 Back up accounts


cd /var/cpanel/users
for i in `ls -1 *`; do /scripts/pkgacct --skipdnszones $i; done

Warning: Do not use rsync to back up accounts.


6.9 Back up service configurations


cd /usr/local/cpanel
bin/cpconftool --modules=cpanel::smtp::exim,cpanel::system::backups,cpanel::system::mysql,cpanel::system::whmconf,cpanel::easy::apache,cpanel::ui::themes --backup

6.10 Transfer backups to remote storage


Use scp or rsync to copy files to a safe location.


6.11 Stop services and unmount


service mysql stop
umount {/proc,/dev,/sys}
exit

7. Restore Files to the New Server


7.1 Transfer backups to the new server


Use scp or rsync.


7.2 Restore feature lists


cd /backups
tar -xzvf _var_cpanel.tar.gz var/cpanel/features

7.3 Restore accounts


cd BACKUPDIRECTORY/TYPE/DATE/accounts/
for archive in `ls`; do /scripts/restorepkg $archive; done

7.4 Restore configuration settings


/usr/local/cpanel/bin/cpconftool --restore

7.5 Restore CloudLinux settings (if applicable)


8. Test the Server


Verify websites, applications, email, and all services to ensure the restoration is complete and functional.


9. Reconnect to a tmux Session


tmux ls
tmux a -t example

Conclusion


This disaster recovery process ensures that you can rebuild and restore a cPanel & WHM server after catastrophic hard‑drive failure. Following these steps carefully helps preserve data integrity and restore full service functionality.


Written & researched by Dr. Shahin Siami