How to: Manually transfer an account between servers
For cPanel & WHM version 11.40
Sometimes, accounts are too large to move using the WHM Transfers
set of features. However, you can still move the accounts manually.
To begin this process, you will need to log into your server as the root
In this tutorial, we will use the following information:
We will begin by creating a temporary directory that will store certain parts of the account we wish to transfer.
Creating a temporary directory using the mkdir command
To create a temporary directory, we will need to use the
This command will not produce any output. It will create a directory called
inside of the
Creating a compressed backup of public_html
Most of an account's disk space usage will occur within its
directory. So, we can reduce the size of the transfer by temporarily omitting the
directory from the transfer process. To do so, we will need to create a compressed backup of the directory.
To create a compressed backup, use the tar
is an archive utility that is also capable of compressing the archive, when given the appropriate arguments.
tar cvzf /home/user-temp/user-backup.tar.gz /home/user/public_html
In the example above, we are creating a compressed archive of the
In this case, the
- 4 parameters (
- 2 input variables (
|| Creates a new archive. We have to pass the tar utility the -c argument as it tells the utility to create a new archive versus, for example, extracting an existing archive.
|| Prints to the CLI verbose information about what tar is doing. While this argument is not required, it makes it easy to see what is going on, should you encounter any errors.
|| Uses the gzip compression utility to compress the new archive. This saves disk space. For more information about gzip, visit die.net's gzip man page.
|| Causes the tar utility to read from and write to the specified file. In this case, we are writing to a file called
Moving public_html using the mv command
Now that we created a compressed backup of the
directory, we can move the
directory to the temporary folder we created in the first step. To do so, we can use the mv
mv /home/user/public_html /home/user-temp/
You should never
directory before the transfer is complete. You should make sure to keep a copy of the
directory at all times during the transfer process, so that the site can still be restored should you encounter any failures along the way.
Creating compressed backups of logs
Large websites often have large logs that accompany them. We can save ourselves more transfer time and disk space if we create a compressed backup of these logs.
We can find the domain's Apache
Let's follow the same set of steps as above. We will create a compressed backup of the domain's weblogs and move the weblogs from their current location in
to the temporary directory.
root@publicdocs [~]# tar -cvzf /home/user-temp/user-logs.tar.gz /usr/local/apache/domlogs/example.com
root@publicdocs [~]# mv /usr/local/apache/domlogs/example.com /home/user-temp/
- The first command creates the compressed backup of the domain's logs in
- The second command moves the existing log files to the temporary directory.
Manually transferring the compressed backups using the scp command
There are several methods for transferring the compressed backups we have created. For this article, we'll use the scp
stands for secure copy. We can use this protocol to transfer files between servers. This method is fast and secure, and we will not have to use any arguments. We simply need to give the scp
utility a file to move and place to go.
scp $local file to move $remote host:/path/to/new/file
For our purposes, let's pretend that we have root
access on the remote machine, and that the remote host is
. Along with the username and password for the remote server, we'll need to specify a path for the files we want to copy on the remote server. In this case, let's pretend the remote directory is
scp /home/user-temp/user-logs.tar.gz firstname.lastname@example.org:/home/temp/
scp /home/user-temp/user-backup.tar.gz email@example.com:/home/temp/
Depending on the remote server's configuration, you may need to specify a few arguments to scp
|| This argument allows you to specify a port number. You will need to specify the port number if the remote server does not use the default SSH port (
scp -P 372 /home/user-temp/user-logs.tar.gz firstname.lastname@example.org:/home/temp/
|| This argument allows you to specify a key file if the remote server requires key-based authentication.
scp -i key-name /home/user-temp/user-logs.tar.gz email@example.com:/home/temp/
|| This argument will cause the scp utility to produce verbose output. You should use this argument if you are experiencing problems with the scp utility.
scp -v /home/user-temp/user-logs.tar.gz firstname.lastname@example.org:/home/temp/
These 2 commands will individually transfer the compressed backups we created of the user's
logs to the
directory on the other server. You will be prompted for the password when you connect to the other server, so make sure you have that information at hand.
Now that we have moved the 2 largest parts of the website manually, we can use the WHM Copy an account from another server
interface to move the rest of the account information. This should be a speedy process.
Extracting the compressed backups
Once we have transferred our 2 compressed backups over and finished transferring the account, we'll need to extract the compressed backups to their appropriate locations. To do so, we'll need to use the tar
utility again. This time, we will pass the tar
utility a different set of arguments.
tar -xvzf $file-to-extract.tar.gz $/path/to/place/contents/
As you can see, we simply need to change the -c
argument to -x
. This argument tells the tar
utility to extract information from the files specified, rather than to create a file.
For example, let's restore the user's
on the new system. We'll also need to extract the Apache
tar -xvzf /home/temp/user-backup.tar.gz /home/user/
tar -xvzf /home/temp/user-logs.tar.gz /usr/local/apache/domlogs/
Once you have completed the transfer and restored the backups you have created, you should have successfully moved the account.