Overview
On a Dedicated Server the DreamHost panel has no restore option, so you restore a website backup over SSH as an admin user (switched to root) using rsync from the /mnt/backup directory. This article explains how to restore the most recent backup and older ZFS snapshots.
This article assumes you have added an admin user and are able to log in via SSH.
Once logged in, switch to the root user using sudo -s or sudo -i before running the commands below.
How do I restore the most recent backup?
These steps restore the most recent backup from the /mnt/backup directory.
- Log in to your server via SSH using your admin user.
- Change into your user's home directory.
[server]$ cd ~
- Rename the active directory of the website you wish to restore. For example, if your site is example.com, rename it to example.com.old.
[server]$ mv example.com example.com.old
Please note this will immediately take down your site until the files are copied from the backup.
- Create a new empty website directory for your website (e.g., example.com).
[server]$ mkdir example.com
- Run rsync to copy the files from the /mnt/backup directory to this new blank website directory:
[server]$ rsync -av /mnt/backup/home/username/example.com/ /home/username/example.com/
Once the files are copied, your website should immediately appear online again.
How do I restore an older backup?
If you need to restore an older backup, you can find them in the .zfs and snapshot directory:
[server]$ /mnt/backup/.zfs/snapshot# ls zfs-auto-snap_daily-2024-03-27-16h18 zfs-auto-snap_daily-2024-03-30-16h18 zfs-auto-snap_daily-2024-04-02-16h18 zfs-auto-snap_daily-2024-03-28-16h19 zfs-auto-snap_daily-2024-03-31-16h18 zfs-auto-snap_weekly-2024-03-26-16h18 zfs-auto-snap_daily-2024-03-29-16h18 zfs-auto-snap_daily-2024-04-01-16h18 zfs-auto-snap_weekly-2024-04-02-16h18
To restore something from a snapshot, rename the directory of the website you wish to restore as mentioned above, create a new blank directory, then run rsync:
[server]$ rsync -av /mnt/backup/.zfs/snapshot/SNAPSHOTDIR/home/username/example.com/ /home/username/example.com/