Data loss can be disastrous for any website, especially if you’re managing multiple client accounts through WHM (Web Host Manager). That’s why it’s essential to automate your WHM backup system and store your data securely off-site. One of the most efficient and reliable solutions is setting up WHM backup to Google Drive.
In this comprehensive guide, we will walk you through the step-by-step process of integrating Google Drive with WHM, so your data remains safe, recoverable, and easily accessible when needed. If you’re looking for the best way to automate and simplify your WHM backup tasks, this tutorial is a must-read.
Why Choose Google Drive for WHM Backups?
Google Drive offers up to 15GB of free storage and flexible paid plans, making it an excellent off-site backup location. Integrating it with WHM provides:
- Off-server protection against hardware failure.
- Easy access to stored files from anywhere.
- Integration with Google’s powerful security systems.
- Cost-effective long-term storage.
💡 Tip from Hostrago: Always use a dedicated Google account for server backups to maintain organization and security.
Prerequisites for Setting Up WHM Backup to Google Drive
Before beginning, ensure the following:
- WHM access with root privileges.
- A valid Google account.
- rclone installed on your server.
- Command line (SSH) access to the server.
Step-by-Step Guide to Set Up WHM Backup to Google Drive
Let’s dive into the configuration process.
Step 1: Install Rclone on Your Server
- Login via SSH as root.
- Run the following command: bashCopyEdit
curl https://rclone.org/install.sh | bash
- After installation, verify it: bashCopyEdit
rclone version
Step 2: Configure Rclone for Google Drive
- Start rclone configuration: bashCopyEdit
rclone config
- Follow the interactive prompts:
- Choose
n
to create a new remote. - Name it (e.g.,
gdrive
). - Select
drive
as the storage type. - Accept default or advanced settings.
- When prompted for client ID and secret, press Enter unless you have custom credentials.
- Follow the link to authenticate your Google account.
- Once authenticated, allow access and paste the verification code.
- Choose
Your remote is now set up.
Step 3: Create a Backup Script
Here’s a basic shell script to backup WHM data and sync it with Google Drive:
#!/bin/bash
DATE=$(date +%F)
BACKUP_DIR="/backup/whm"
ARCHIVE="$BACKUP_DIR/whm-backup-$DATE.tar.gz"
# Create backup
mkdir -p $BACKUP_DIR
/scripts/pkgacct --skiphomedir --skiphomemysql --skiphometmp --user=root$BACKUP_DIR
# Compress backup
tar -czvf $ARCHIVE $BACKUP_DIR
# Sync with Google Drive
rclone copy $ARCHIVE gdrive:/WHM-Backups
# Clean up
rm -rf $BACKUP_DIR
Step 4: Verify Your Backup
Once the script runs:
- Go to your Google Drive.
- Open the
WHM-Backups
folder. - Verify the latest backup file exists.
You can also run:
rclone ls gdrive:/WHM-Backups
…to check via SSH.
Troubleshooting Tips
Problem: Permission Denied Errors
Solution: Ensure the script and backup directory have root permissions.
Problem: Rclone Authentication Fails
Solution: Double-check the authentication link and try again in incognito mode.
Problem: No space left on device
Solution: Clean up older backups regularly or upgrade your Google Drive plan.
Final Thoughts
Setting up WHM Backup to Google Drive is a smart and efficient way to ensure your cPanel accounts are always protected. It eliminates the risk of total data loss, keeps your backups off-site, and adds an extra layer of redundancy to your web hosting infrastructure.
At Hostrago, we strongly recommend every server admin or reseller hosting provider implement automated backup strategies like this one.
If managing backups, server scripts, or SSH commands feel overwhelming, you can explore our managed VPS hosting services with full backup support.