How to determine high disk usage locations
This article describes how to determine where your account is using the most disk space.
Determining disk usage
To maintain the reliability and performance of servers for all users, A2 Hosting monitors disk space usage. If you have a lot of files and directories, though, you may not know where exactly your account is using the most disk space.
To determine your account's disk usage, follow these steps:
- Log in to your account using SSH.
- To make sure you are in your home directory, type the following command:
Type the following command:
du -sh * | sort -h
If you have a large number of files and directories in your account, this command may take some time to complete.
This one-line command uses the du command to calculate disk usage statistics for every file and directory in the current directory (in this case, your home directory). It then uses the sort command to sort the data usage statistics, with the smallest files and directories at the top, and the largest files and directories at the bottom. The following example shows typical output from the command:
To view disk usage for a particular subdirectory, change to the directory (for example, type cd public_html), and then rerun the command in step 3. You can progressively step into subdirectories, run the command, and determine where exactly your account is using the most disk space.
You can add the total amount of disk space usage to the output by using the -c option for the du command. For example:
du -shc * | sort -h
Reducing disk usage
If disk space usage for your account is too high, you should try to determine the cause as soon as possible so you can bring it back down to an acceptable level. Some common causes of high disk usage are:
- Databases: Comment spam from unsecured WordPress applications can cause a database to grow very quickly. Similarly, an account receiving large amounts of spam can cause log files to grow large. Consider adding CAPTCHA protection to your web site. For more information about how to reduce spam, please see these articles.
- Recursive backups: Consider this scenario—you create a backup. Then a WordPress plugin or cron job creates a backup of the backup. Before you know it, you have a runaway process creating files of increasing size. This is a guaranteed way to quickly use up disk space. Make sure you are aware of all the processes on your account that may create a backup or other large file, and make sure they do not conflict with each other.
- Cron jobs or other automated processes: Automated processes, such as cron jobs, can create a large number of files very quickly. Either modify or disable the cron job, or delete the unwanted files.
- E-mail messages: Old messages in the Trash and Sent folders of users' mailboxes often accumulate. You can download these messages to your local computer (if you want to save them), and then delete them on the server.
If your web site's storage needs are increasing, please contact our sales department at http://my.a2hosting.com
to discuss upgrade options. Common upgrades for shared hosting accounts are a managed VPS or a dedicated server. These packages offer dedicated resources that can streamline your site's performance. They also include full management and the cPanel control panel.
- Excessive disk usage on shared hosting accounts
You may receive an e-mail message from A2 Hosting about excessive disk usage on a shared account. These Smart System Notifier messages allow us to work together to improve your site’s performance and stability before it becomes an issue that affects the entire server.
- Disk Space Usage
You can use cPanel to view your account’s disk usage.
- Inode count
The inode count represents the total number of files and directories in an account or on a disk. This article shows you how to determine the inode count for your account.
- Resource limit information
cPanel enables you to view resource limit information about your account. You can also view snapshots of running processes and database queries to help determine what caused resource limiting for your account.