Overview
This article explains how to use an admin user to restore a website backup for your Dedicated server. This is the only way to restore a website, as a restore option is not available within the DreamHost panel.
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.
Restoring 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.
Restoring older backups
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/