- April 2021: OCIO Web Hosting now keeps a 14-day daily backup of your hosted Document Root & its associated databases. As a result, this document has been largely deprecated and replaced by this document. These commands though are still valid, and have been left here as a reference.
Backing up your website and then restoring it when something goes wrong is absolutely critical. Web Hosting only guarantees disaster recovery services but it’s far more likely that a website will be down due to a new module misbehaving, accidental deletion of files, etc. Drupal’s drush utility makes backing up and restoring sites simple and can also be used to migrate a site from one account to another. (i.e. migrating from a development account to the production one)
You will need SSH access to your website so please request it if you don’t already have it.
This creates a snapshot backup of the website into a file called mysite.tar located in the php-data/ directory of the account.
cd /usr/local/webs/mysite/htdocs/ drush archive-backup --destination=/usr/local/webs/mysite/php-data/mysite.tar
This restores a website from a backup. Note that it will overwrite the current site and any changes you’ve made since the snapshot was taken.
drush archive-restore /usr/local/webs/mysite/php-data/mysite.tar \ --overwrite \ --destination=/usr/local/webs/mysite/htdocs
To migrate a website from one account to another you first make a standard backup as shown above. Then transfer the file to the other account. (in this case it’s placed into the php-data/ directory) You can then execute a restore; however, you will need to update the database credentials to the appropriate values for this account. drush has built this update directly into the restore command.
drush archive-restore /usr/local/webs/anothersite/php-data/mysite.tar \ --overwrite \ --destination=/usr/local/webs/anothersite/htdocs \ --db-url=mysql://dbuser:firstname.lastname@example.org/dbname
Note that dbuser, dbpassword, and dbname are for the destination account and all must exist prior to executing this command. (It won’t create any of them)
Need More Information?
Is OSU Web Hosting right for you? Check your eligibility.
Ready to get started? Request hosting now!