Manual Migration from slaved drive to new one

The following guide was taken from Cpanel support forum. This information is when you need to migrate Cpanel account information from one drive or to another.

Manually moving Cpanel

These commands will allow you to manually migrate all customer data and configs from an old primary drive installed as a slave.

source drive should be mounted to /mnt/slave1

run chkrootkit to make sure you don’t copy back infected files.. chkrootkit — locally checks for signs of a rootkit

now we can start copying back data from the old drive

Run these rSync commands to move everything over:


# rsync -vrplogDtH /slave1/usr/local/apache/conf /usr/local/apache
# rsync -vrplogDtH /slave1/var/named /var
# rsync -vrplogDtH /slave1/home/* /home
# rsync -vrplogDtH /slave1/usr/local/cpanel /usr/local
# rsync -vrplogDtH /slave1/var/lib/mysql /var/lib
# rsync -vrplogDtH /slave1/var/cpanel /var
# rsync -vrplogDtH /slave1/usr/share/ssl /usr/share
# rsync -vrplogDtH /slave1/var/ssl /var
# rsync -vrplogDtH /slave1/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
# rsync -vrplogDtH /slave1/var/log/bandwidth /var/log
# rsync -vrplogDtH /slave1/usr/local/frontpage /usr/local
# rsync -vrplogDtH /slave1/var/spool/cron /var/spool
# rsync -vrplogDtH /slave1/root/.my.cnf /root
# rsync -vrplogDtH /slave1/etc/httpd/conf/httpd.conf /etc/httpd/conf

* rsync options
-v, –verbose increase verbosity
-r, –recursive recurse into directories
-p, –perms preserve permissions
-l, –links copy symlinks as symlinks
-o, –owner preserve owner (super-user only)
-g, –group preserve group
-D same as –devices –specials
-t, –times preserve modification times
-H, –hard-links preserve hard links

See a list of all the options –

cd to the old etc directory:


#cd /slave1/etc

And copy some files from here:


# rsync -vrplogDtH secondarymx domainalias valiases vfilters exim* proftpd* pure-ftpd* passwd* group* *domain* *named* wwwacct.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts /etc 

Update cpanel afterwards


# /scripts/upcp
# /scripts/updatenow
# /scripts/sysup
# /scripts/fixeverything
# /scripts/exim4
# /scripts/easyapache
# /scripts/securetmp 

Restarting services


# /scripts/restartsrv httpd
# /scripts/restartsrv cpanel
# /scripts/restartsrv mysql
# /scripts/restartsrv named
# /scripts/restartsrv exim 

Source: http://forums.cpanel.net/f49/help-moving-cpanel-accounts-damaged-disk-163734.html

Move a site from one plesk domain to another

How do you move a site from one plesk domian to another on the same server?

The ftp and export method.

Get your data.

1. Ftp to the old site and download the files to your local computer.
2. Login to the plesk panel and go to Manage Hosting for the old domain. Go to Websites and Domains. Go to databases. Click on the database name. Click Webadmin. Click Export Tab. Click Custom. make sure all the databases tables are selected (blue). Click Go. This should produce a popup so you can save the file locally.

New Domain.

1. Login to pelsk and click subscriptions. Click Add New Subscription. Fill out the details (make note of the new username and password) and and click okay.
2. ftp to the new domain and upload the files from the old domain.
3. Go to Manage Hosting for the new domain. Go to Websites and Domains. Go to databases. Click add new database. Click on the database name after creation and add a new database user. Click on Webadmin and go to the import tab. Locate the file for the database download and upload. You should see all the tables at this point.
4. Locate the database config file in the new database and edit it with the new database name, user and password.

Move Data from Slaved Drive – Plesk

First you will want to set up subscriptions for the domains in the plesk panel. Once they are created you can run the commands below:

Here are a few commands that should help.

1.) rsync example. This will move the data from one drive to the other.


rsync -avz /mnt/slave/var/www/vhosts/"domain name"/httpdocs /var/www/vhosts/"domain name"/httpdocs

You will want to change the “domain name” to the one you are working on at the time.

2.) Changing ownership:


chown -R "ftpusername":psacln /var/www/vhosts/"domain name"/httpdocs/*

You will want to change the “ftpusername” to what you set up for each domain when creating the subscription.

If the sites are simple, these are the only 3 steps you should need to take for each domain.

Update:

I would use the rsync command rather than cp. Rsync will keep permissions the same. The command would look something like:


rsync -aPSv /mnt/olddrive/var/www/vhosts/domain.com/httpdocs/somedirectory/ /var/www/vhosts/domain.com/httpdocs/restoredirectory/

You can also preview what will be synced by adding –dry-run to the command. This doesn’t actually copy anything, just shows you what’s going to happen e.g.


rsync -aPSv /mnt/olddrive/var/www/vhosts/domain.com/httpdocs/somedirectory/ /var/www/vhosts/domain.com/httpdocs/restoredirectory/ --dry-run

The databases are in /mnt/olddrive/var/lib/mysql

One thing you might try is to stop mysql, change datadir in /etc/my.cnf to /mnt/olddrive/var/lib/mysql, then restart mysql and dump your databases. Then stop mysql, revert datadir back and restart mysql again.

When MySQL is running using the slaved drive as the datadir, you can use this to log in to MySQL:


mysql -uadmin -p`cat /mnt/olddrive/etc/psa/.psa.shadow

alternately you can set skip-grant-tables in the /etc/my.cnf file until you have things running again.

You can either dump your databases as one file or as separate files for each DB – http://www.commandlinefu.com/commands/view/2916/backup-all-mysql-databases-to-individual-files