(dv) 4.0:Restore Data after Reverting to Default

  • This page was last modified on March 27, 2012, at 11:44.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

This article is only relevant for the (dv) Dedicated-Virtual 4.0; if you have a (dv) Dedicated-Virtual 3.5, a similar script can be found in the following article: (dv) 3.5:Restore Data

Contents

This script is run completely at YOUR OWN RISK.

You should only use the script AFTER you have removed all exploited code and ensured that all hacks have been removed. Running this script without having cleaned out exploited code from your /old directory can potentially have the result of re-infecting your server.

(mt) Media Temple does not troubleshoot re-installs nor hacked servers.

Overview

This article provides instructions on obtaining and using a script designed to assist with the restoration of your site content and Plesk settings after you have reverted your (dv) Dedicated-Virtual 4.0 to default. If you have customized your (dv) Dedicated-Virtual 4.0 outside of Plesk, the chances of this script not functioning as expected increase.

The script can only be run on data from a version of Plesk which matches the version of Plesk currently installed. When you revert a (dv) Dedicated-Virtual 4.0 to default, the fresh version of Plesk which is installed on your server may be different from what you had running on it originally. Currently, the version of Plesk which is installed when you revert to default is 10.4.4. If you are running Plesk 10.1.1, 10.3.1, or any other lower version number at the time you are hacked, for instance, it would be necessary to attempt to upgrade to Plesk 10.4.4 before reverting to default if you plan on using this script. Obviously, depending on the state of your server, the upgrade process may not be able to complete, in which case the restoration of your data would need to be done manually. If you are running 10.4.4 or a version newer than that prior to reverting to default, the script can help you upgrade the live version of Plesk after the server has been reverted to default, so that the versions match. You can check your version of Plesk by looking at the /usr/local/psa/version file.

Requirements

  • To use this script, you will need to have a reverted your server to default. For information on doing so, please see:

Revert your (dv) 4.0 to default

  • The version of your previous Plesk instance must match the version of your newly installed Plesk instance. Please see the caution box above for more information.
  • You must have SSH access as the root user. For information on SSH access and setting the root password, please see the following articles:

Connecting via SSH to your server

How do I enable root access to my (dv)?

  • You must have researched the matter that caused you to have to revert your server to default in the first place, giving careful consideration to whether or not to use this script and to the security and integrity of the files that you will be moving back onto the live area of your (dv) Dedicated-Virtual Server.

Instructions

Of course, this script is provided without guarantee and you are responsible for any consequences of running it. This script is entirely outside of the (mt) Media Temple Scope of Support.

The dv_40restore.sh BASH script can be found on the (dv) 4.0 Restore Project GitHub Page, along with the revisions it has gone through. The easiest way to get the latest revision of this script on your (dv) Dedicated-Virtual is by logging in as the root user via SSH, then executing the following command:

wget --no-check-certificate https://github.com/qumak/dv_40restore.sh/raw/master/dv_40restore.sh

I highly recommend taking a look at the script to get an idea of its functionality, if you are at all familiar with BASH scripting. If you are unable to successfully run the script, looking at its code may still be useful to you as you manually restore your old data.

Now that you have downloaded the script, if your old data is located in /old, you can run it with the following command:

sh dv_40restore.sh

If your old data is located elsewhere, you can pass the directory containing your old data as an argument to the script. For instance, if you have reverted to default twice and want to use the data from before the last time you reverted, you could issue this command:

sh dv_40restore.sh /old/old

Be sure to read all prompts carefully before responding to the question while running the script. When you see a prompt that looks like "YES/[no]", the bracketed option is the default value (if you just press enter) and the capitalized option must be typed out in full ("yes", not "y") in order to proceed.

Notes of Interest

That's it! - If it didn't fail, the script should have taken care of the bulk of your restoration for you.

  • The script does not remove any data from the /old directory, so you can always try your restoration again, whether that means reverting to default again and restoring from the /old/old directory, or if it means finishing the job by manually moving files around.
  • Certain key files and directories from your Plesk installation would have been copied to a backup directory before the script potentially overwrote them. By default this backup directory is /opt/mt_restore_backup.
  • The script will have copied the actual MySQL database files from your old data to the live area. If you need to get database dumps from your old databases, however, you can try the dbrestore.sh script from the following article subsection:

(dv) 3.5:Restore Data :: Recover databases

Relevant Links