BuycPanel Blog

BuycPanel Blog

Latest news and updates

How to Compress Public_html and Logs while Transferring an Account Between Servers?

Posted by Allura on 24 06 2019.

Introduction
If accounts are too large and is creating difficulty for a user in moving the accounts with the WHM Transfers feature, one can move the accounts manually by logging in as the root user. Below are the information that will be used in this review:Username: userDomain: example.comCreate a Temporary Directory with the mkdir Command
To do this, a user has to run the following mkdir command:mkdir /home/user-tempIt is to note that this command is not responsible in producing any output. It creates the user-temp directory inside of the /home directory.
 
A Compressed Backup of the public_html Directory
Settings of how cPanel & WHM creates subdomain and addon domain directories can be changed. On the other hand, these directories may not exist on some servers in the the cPanel account’s public_html directory. One can read our Tweak Settings – Domains documentation to get more information on this topic.As a fact, almost all the…

Introduction

If accounts are too large and is creating difficulty for a user in moving the accounts with the WHM Transfers feature, one can move the accounts manually by logging in as the root user. Below are the information that will be used in this review:

Username: user

Domain: example.com

Create a Temporary Directory with the mkdir Command

To do this, a user has to run the following mkdir command:

mkdir /home/user-temp

It is to note that this command is not responsible in producing any output. It creates the user-temp directory inside of the /home directory.

 

A Compressed Backup of the public_html Directory

Settings of how cPanel & WHM creates subdomain and addon domain directories can be changed. On the other hand, these directories may not exist on some servers in the the cPanel account’s public_html directory. One can read our Tweak Settings – Domains documentation to get more information on this topic.

As a fact, almost all the account’s disk space usage occurs in its public_html directory. A user can thus reduce the size of the transfer by creating a compressed backup of the public_html directory and omit it from the transfer process.

To do this, a user has to use this tar command:

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

By using the above command, the tar utility receives four arguments ( cvzf ) and two input variables ( /home/user-temp/user-backup.tar.gz and /home/user/public_html ).

c: This argument creates a new archive.

v: This argument prints verbose information about the tar utility’s actions to the command line.

z: This argument compresses the new archive and saves disk space.

f: This argument enables the tar  utility to read from and write to the specified file.

Move public_html with the mv Command

To do this, a user has to run the following mv command:

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

Keep in mind to never remove the public_html directory before the transfer completion. Also, try maintaining a copy of the public_html directory throughout the process for ensuring to restore the site if the process anyhow fails.

Create Compressed Backup of Logs

Large logs are generated by large websites. In order to economise the transfer time and disk space, try creating a compressed backup of these logs. The /usr/local/apache/domlogs directory will store the domain’s Apache weblogs.

To do this, 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/

where the first command creates the compressed backup of the domain’s weblogs in the /home/user-temp/user-logs.tar.gz directory, and the other helps in moving the existing weblog files to the temporary directory.

Conclusion

All information on compressing public_html logs are outlined in this review.