---
title: "Understanding storage usage"
date: "2015-04-09"
category: "control-panel"
slug: "understanding-storage-usage"
---

The [[logging-into-the-control-panel]] provides a comprehensive storage breakdown via **Files** > **Storage Usage**. A graphical overview is available under _Storage Usage_, and a detailed file listing can be downloaded via **File Listing** > **Download File Listing**.

![Sample storage usage overview](kb-image:sample-storage-usage.png)
*Sample storage usage overview*

## What Counts Toward Storage

Any file created on your account contributes to storage usage, including:

- MySQL and PostgreSQL databases
- FTP uploads
- Email messages
- Web server logs
- Files uploaded to your website
- Files created within the control panel

**Note:** Web server logs cannot be adjusted or removed. A minimum of five days of log files are retained for security audit purposes. These appear as `/var/log/httpd/access_log{,.1.gz,.2.gz,.3.gz,.4.gz}`. The `error_log` file can be removed on special request in extreme situations via support ticket, but it contains valuable diagnostic information for incident response.

## How Storage Is Calculated

Each file is rounded up to the nearest 4 KB block size. For example:

- A 5-byte file uses 4 KB of storage
- A 4,097-byte file uses 8 KB of storage

This means many small files can have inflated storage usage. For example, 10,000 files at 1 KB each would occupy 40 MB (10,000 x 4 KB) rather than the expected 10 MB. Email messages are particularly affected by this.

## Apache User Storage

All PHP scripts run as a separate system user called "apache" (named after the [web server](http://httpd.apache.org/)). Storage attributed to this user includes any file uploaded through a PHP application (WordPress, Drupal, Joomla, etc).

### Why a Separate User

Running PHP under a separate user provides three key benefits:

1. Malicious code uploaded through outdated PHP applications is easily identified by file ownership
2. You can clearly see how much storage PHP uploads consume
3. If your site is compromised, the attacker cannot access your control panel, email, SSH keys, or SSL certificates

## Detailed Storage Listing

Download a CSV file of all files counted toward storage via **File Listing** > **Download File Listing**. This can be imported into any spreadsheet application.

**Note:** Generation may take several minutes for large accounts.

The CSV contains four fields:

1. **quota**: Storage in kilobytes, rounded to the nearest 4 KB block
2. **szdisk**: Actual file size in bytes on disk
3. **username**: The user the storage is credited to
4. **path**: File location on the server

### Paths That Should Never Be Removed Directly

- `/var/lib/mysql`: MySQL database files. Direct removal causes database corruption. Use **Databases** > **MySQL Manager** to drop databases.
- `/var/lib/pgsql`: PostgreSQL database files. Direct removal causes complete database corruption across all databases. Use **Databases** > **PostgreSQL Manager** to drop databases.
- `/var/log/httpd`: HTTP request audit logs. Removing these while your account is compromised will result in account termination.

### Removing Files

Files can only be removed by their owner (the _username_ field in the CSV). When deleting files via [[accessing-ftp-server]] or [[accessing-terminal]], access is denied if the file's owner does not match your login. To work around this, either use [[switching-users]] (available on [[determining-platform-version]] platforms) or the control panel File Manager (**Files** > **File Manager**).

### Storage Discrepancies

In rare cases, the storage shown in the control panel may not match the detailed file listing. This is caused by accounting inconsistencies and typically affects multiple users on a server. If you notice a significant discrepancy (an order of magnitude or more) for any user other than apache, open a support ticket.
