AdminsForum

CloudPanel Backups & Migration Guides

Guide How to Restore a Site From a CloudPanel Backup (Files and Database)

Started by JAY 0 replies 104 views
1JAY
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
#1
How to restore a site from a CloudPanel backup (files and database)

A backup is only worth something if you can restore it. This guide walks through restoring a CloudPanel site, step by step: getting the backup file, putting the files back and importing the database. If your backups aren't being created at all, start with CloudPanel backups not running.

What a CloudPanel backup contains
CloudPanel's remote backups (set up under Admin Area > Backups) contain each site's vhost and its entire home directory, except the
Code:
.ssh
,
Code:
logs
and
Code:
tmp
folders. They're stored with your chosen provider (S3, Wasabi, DigitalOcean Spaces, Dropbox, Google Drive, Hetzner Storage Box, SFTP or a custom Rclone remote).

Before you start
  • Back up the current state first, even if it's broken. If the restore goes wrong, you can return to where you started:
    Code:
    tar -czf /root/before-restore-$(date +%F).tar.gz /home/siteuser/htdocs/example.com
  • Put the site into maintenance mode or warn visitors if it's live.
  • Know the database name and user (site > Databases).

Step 1: Get the backup file
Download the backup for the right date from your storage provider (for example the Dropbox
Code:
Apps/CloudPanel/
folder, your S3 bucket, or your SFTP server). You need the site's
Code:
backup.tar
file.

Step 2: Upload it to the site's tmp folder
  • Under 2 GB: open the site's File Manager, go to the
    Code:
    tmp
    folder and upload
    Code:
    backup.tar
    .
  • Over 2 GB: upload it with SFTP as the site user into
    Code:
    ~/tmp/
    . See CloudPanel SSH, SFTP, FTP and File Manager.

Step 3: Extract it as the site user
Log in over SSH as the site user (not root, so file ownership stays correct):
Code:
cd ~/tmp tar xf backup.tar ls -la
Look around the extracted folders until you find the site files (
Code:
htdocs/example.com
) and any database dump files (
Code:
*.sql
or
Code:
*.sql.gz
).

Step 4: Restore the files
You can restore everything, or just what you need (for example one deleted folder). To replace the whole site:
Code:
rsync -a --delete ~/tmp/PATH-TO/htdocs/example.com/ ~/htdocs/example.com/
Replace
Code:
PATH-TO
with the path you found in Step 3. The trailing slashes matter. Leave out
Code:
--delete
if you only want to add back missing files without removing newer ones.

Step 5: Restore the database
If you found a database dump, import it as root with clpctl:
Code:
clpctl db:import --databaseName=my_database --file=/home/siteuser/tmp/PATH-TO/my_database.sql.gz
Both
Code:
.sql
and
Code:
.sql.gz
work. The import replaces the current tables with the ones from the backup.

No dump in the backup? Look for database dumps elsewhere in the site user's home folder (
Code:
ls -R ~ | grep -E '\.sql(\.gz)?$'
). If there are none, start making them: a nightly cron job (the site user can run it) with
Code:
clpctl db:export --databaseName=my_database --file=/home/siteuser/db-backups/my_database.sql.gz
keeps a fresh dump in the site's home folder, so every future backup includes your database. See clpctl cheat sheet.

Step 6: Check and clean up
  • Fix ownership in case anything was copied as root:
    Code:
    chown -R siteuser:siteuser /home/siteuser/htdocs/example.com
  • Purge the Varnish cache for the site.
  • Test the home page, a login, a form and the admin area.
  • Delete the extracted files and backup.tar from
    Code:
    ~/tmp
    . They take space and contain your database.

Test restores before you need them
The best time to learn this is on a quiet day. Restore a recent backup to a test subdomain once a month. If it works there, it'll work when it matters.

Sources: CloudPanel: remote backups · CloudPanel: clpctl db:import


More CloudPanel troubleshooting
Applies to CloudPanel v2 on Ubuntu and Debian, October 2026. In the commands, replace
Code:
example.com
with your domain and
Code:
siteuser
with your site's user name (shown on the site's Settings page).
Reply
Possibly Related Threads…matched by title
Replies:0Views:94
Replies:0Views:116

Users browsing this thread: 1 Guest(s)
Forum Jump: