How to Manually Transfer an Account Between Servers

Overview

When accounts are too large to move with the WHM Transfers features, you can move the accounts manually. To do this, you must log in as the root user.

This tutorial uses the following information:

Username user
Domain example.com

Step 1: Create a temporary directory with the mkdir command:

To create a temporary directory, run the mkdir command:

# mkdir /home/user-temp

Note:
This command does not produce output, but creates the user-temp directory inside of the /home directory.

Step 2: Create a compressed backup of the public_html directory:

Typically, most of an account’s disk space usage occurs in its public_html directory. If you create a compressed backup of the public_html directory and omit it from the transfer process, you can reduce the size of the transfer.

To create a compressed backup, run the tar command:

# tar cvzf /home/user-temp/user-backup.tar.gz /home/user/public_html

Notes:

– This command is an archive utility that compresses the archive when you give it the appropriate arguments.
– This results in a compressed archive of the pubic_html directory that the system creates in the /home/user-temp/user-backup.tar.gz directory.

Step 3: Move public_html with the mv command

To move the public_html directory to the temporary folder that you create, run the following mv command:

# mv /home/user/public_html /home/user-temp/

Warning:
Never remove the public_html directory before the transfer finishes. Maintain a copy of the public_html directory throughout the transfer process, to ensure that you can restore the site if you encounter failures.

Step 4: Create compressed backups of logs

Large websites usually generate large logs. To save transfer time and disk space, create a compressed backup of these logs. The /usr/local/apache/domlogs directory stores the domain’s Apache weblogs.

To create a compressed backup of the domain’s weblogs and move the weblogs from the /usr/local/apache/domlogs directory to the temporary directory, run the following two commands:

# tar -cvzf /home/user-temp/user-logs.tar.gz /usr/local/apache/domlogs/example.com
# mv /usr/local/apache/domlogs/example.com /home/user-temp/

Notes:

– The first command creates the compressed backup of the domain’s weblogs in the /home/user-temp/user-logs.tar.gz directory.
– The second command moves the existing weblog files to the temporary directory.

Step 5: Manually transfer the compressed backups with the scp command

Several methods exist to transfer compressed backups after you create them. The secure copy (scp) protocol transfers files between servers quickly and securely without the use of arguments.

To manually transfer compressed backups, run the scp command:

# scp $local file to move $remote host:/path/to/new/file

Important:
You must possess the username and password for the remote server, and specify a path for the files that you wish to copy on the remote server.

For example, to transfer compressed backups to the /home/temp/ directory, run the following commands:

# scp /home/user-temp/user-logs.tar.gz root@domain.com:/home/temp/
# scp /home/user-temp/user-backup.tar.gz root@domain.com:/home/temp/

These two commands transfer the compressed backups that you create of the user’s public_html directory and Apache weblogs to the /home/temp/ directory of the new server. The system will prompt you for the password when you connect to the new server. You can now use the WHM Transfer Tool interface to move the rest of the account information.

Step 6: Extract the compressed backups

After you transfer the two compressed backups and finish the transfer of the account, extract the compressed backups to their appropriate locations. To extract the compressed backups to their appropriate locations, run the following command:

# tar -xvzf $file-to-extract.tar.gz $/path/to/place/contents/

This command uses the -x argument instead of the -c argument. The -x argument tells the tar utility to extract information from the specified files.

To restore the user’s public_html directory to the /home/user directory and extract the Apache logs to the /usr/local/apache/domlogs directory, run the following two tar commands:

# tar -xvzf /home/temp/user-backup.tar.gz /home/user/
# tar -xvzf /home/temp/user-logs.tar.gz /usr/local/apache/domlogs/

Note:
When you run these two commands, you transfer and restore the backups that you created, and successfully move the account.