The term “server space” refers to the amount of disk space that is available on your server’s hard disk drive. This space varies according to server type, hosting plan and possibly by additional services that are set up and available on your Liquid Web account.
Some of the largest hard disk drives on the market now can hold up to 100TB of data. To better visualize this, 100 terabytes of data is approximately equivalent to:
- 42,000,000,000 trillion single-spaced typewritten pages
- 8,000,000 phone books
- 160,000 regular compact discs
- 20,000 DVDs
- 200 average-sized hard disks (500GB)
- 80 human brains (the capacity of a human being’s functional memory is estimated to be 1.25 terabytes by futurist Raymond Kurzweil in The Singularity Is Near)
Your disk space can hold many types of data including file types like HTML, TXT, CSS, PHP, PDF, JPG, MP3, MP4, compressed (tar.gz) backups, SQL databases and more. These files are in specific folders which are defined by the applications configuration files or locations you determine.
How do I locate the folders containing a particular set of data?
The location of a file depends primarily on the type of file. On a Linux server, your typical cPanel account is set up under the /home/username folder, and your cPanel account username specifies the username folder. This folder is sometimes called the top-level or root folder of your cPanel account. This root folder is not publicly accessible on the web but, contains folders which are accessible via a web browser. The root folder holds other cPanel specific system folders that use a variety of functions.
As you can see, when uploading files to your account, you’ll likely want them to be in public_html to be accessible on the web. Uploading an image.jpg file to the public_html folder makes it available at domain.com/image.jpg. Additionally, if you create a folder inside of the public_html directory and add the same image there, it would be accessible at yourdomain.com/foldername/image.jpg.
To see the location of a file, you have several options;
- Log into your cPanel and open the File Manager under the Files section
‘cPanel >> Home >> Files >> File Manager’ here you can view all of the files and folders in your account’s root directory.
- When a cPanel account is initially set up, it also creates the main FTP user. You can use the servers FTP functionality to access folders from a remote location to view the file listings. Several software titles like Filezilla, Cyberduck, and WinSCP are available for this type of connection.
- Lastly, you can connect to the server via SSH and get access to folders/files on the server.
How do I see how much space I’m using?
Let’s start by reviewing a few command line examples; mainly the “du” and “df” commands.
The ‘df’ command (abbreviation for disk free) simply lists the space used per partition:
The ‘du’ command (abbreviation for disk usage) reports the sizes of directories including all of their contents and the sizes of individual files:
You can also use cPanel to determine the amount of space used and where its located. If you log in to cPanel, you would need to go to cPanel >> Home >> Files >> Disk Usage to get graphical of your disk usage.
Lastly, to view your server’s disk usage in your Manage account server resource graph
- Log into your Manage portal.
- Navigate to the Servers section and then click on the Plus sign (+) next to the server of focus.
- Click on the Dashboard button and click the link next to the Disk Usage text as seen below
This view provides a graphical representation of your disk space and the used amount.
How do I prevent disk space overages?
Disk space overages can result in lost emails, backups or even websites or the server going down! Just like your car, your server requires regular server maintenance. Attention to server maintenance reduces lost data. One way to prevent disk space overages is to use cPanel’s built-in tools.
cPanel possess the ability to send “Disk Quota Warning” emails that denote when your server is using too much space. They contain specific locations to check, and the space used. The settings for these emails notifications are in WHM (Web Hosting Manager) under the Home »Server Configuration »Tweak Settings .
Other areas of server maintenance to check on regularly include:
- Pruning backups
- Logs are rotating correctly (including Domlogs, Apache2, MySql, and Chkservd)
- Regularly archiving email
- Using the /home directory for large user accounts
What are the dangers of being too close to Disk Quota?
When a server gets close to or is at its max disk space capacity, strange errors and problems can manifest themselves in many ways including:
- Services (like MySQL or Apache) can error out or stop
- Websites can become very sluggish
- The servers overall responsiveness can become slower
- The server may exhibit a high load
- You may see degraded disk performance
- The server may display an increase in I/O wait
- The server may demonstrate an increase in CPU usage
- The file system can go into “read-only” mode
- The server can run out of inodes
- Files can become corrupted
- Decreased swap space may occur causing issues
So what do I do if I’m running out of space?
As Benjamin Franklin stated, “By failing to prepare, you are preparing to fail.” In light of this knowledge, taking steps in advance to prevent these issues is always the best course of action. Directly monitoring your server disk space on a weekly or monthly basis prevents most space issues from turning into actual problems.
If you have already reached the point where immediate action needs to be taken to bring a server back in line with normal space expectations, you have several options. Using the “du” and “df” commands are your primary weapons in tracking down used server space.
The primary steps needed are:
- Log into your server
- Run a df -h command to locate which partitions are using the most space
- Change directories into the affected folders using the most space.
- Run the following command:
(This is an advanced du command that sorts the contents of a directory by size. Use this to drill down into a folder to see used space.)
- Move files (to a backup drive or folder) or, remove the files that are no longer needed using the ‘rm’ command.
- Repeat steps 2 through 6 as needed until reaching desired space level.
Over time, any operating system can become overcrowded with addition and removal of programs or accounts. Actively monitoring your servers disk space is the most effective method to prevent server space issues. If you do run into issues, using the du, df command line tools or, using the graphical interface in your account allows you to view files as needed. As always, if you have further thoughts or questions about this topic, please contact our Linux Support department for more information.