How A Trash-Free Hosting Account Makes A Happy Hosting Account Make it Rain Paper

  • Inodes, cPanel File Management, cPanel File Manager, cpanel hosting
  • 0

In Unix (and its derivatives including Linux, BSD, MINIX that inspired Linux, etc), everything is a file.

From input/output to resources such as documents, hard drives, and even some inter-process and network communications, everything is handled as simple streams of bytes exposed through the filesystem namespace.

 

When your web hosting account is created, it comes with an assigned web space in the disk storage system.

For some web hosting providers, the disk space your hosting account has access to can be limited to a certain size (e.g. 120 GB, etc).

For others, your disk space can be unmetered which is often described as "unlimited".

The average cost of a standard 1 GB of an NVMe disk (depending on the region) may be something like 0.1US$.

Asia or Europe might be 0.14892US$.

So if you are hosting an account in the United States with 120 GB of disk space, the monthly cost for the web hosting service provider would be around (US$ 0.1) * 120 GB = 12 US$.

The hosting provider can afford to term its disk space offering as "unlimited" because the law of average (at least when it comes to web hosting) dictates that in a web server with 100 customers, perhaps only 3-4 out of the total customers will have files over 120 GB in size.

The rest of the customers will likely be within the normal use limits of 10 GB - 64 GB.

That doesn't mean that the web hosting provider will countenance using the web space as a place for you to store your torrented files.

Fair use policy while often something associated with copyright, also applies to the "unlimited" disk space.

The second but probably the most crucial limit that your web hosting account is under is the number of files that your web hosting can hold.

Remember earlier when we stated that "everything in Linux is a file"?

Well, normal disk usage is different from inode usage.

 

How To View Your Disk Space and Inode Usage in cPanel

When you log in to your cPanel and look at the right side of your control panel, you will see the Statistics pane like the image below.

Disk Space vs Inodes in cPanel

The File Usage indicates the number of files you currently have.

The Disk Usage shows the amount of space you still have left.

In this image, you have an unlimited disk space symbolized by the infinity mathematical symbol (∞).

 

Even if your disk usage is unlimited, if you use up your inode allocation, the file system won't be able to allocate an inode number to any new file you might create.

When that happens, you won't be able to create new files but will get an error message such as "Write failed: disk quota exceeded".

In this case, it is not the disk space that is restricting your applications from creating new files, it is the inode limit.

 

How Deleting Files in cPanel Affects Your Hosting Account

When you delete a file using the cPanel File Manager, by default cPanel will be placed in the .trash folder in the account's home directory.

View Trash Folder in cPanel File Manager

See the (dot)?

This indicates that it is a hidden file.

If you have enabled "Show Hidden Files" from your cPanel File Manager's Settings, this folder might not be visible.

So when you delete a file, the file (or files) is in your web hosting account and still counts as part of your web hosting space.

To remove these files from your hosting account and the web server completely, follow these steps:

  • Login to cPanel for the account.
  • Scroll and locate the Files section.
  • Click on the File Manager icon.
  • Click the "View Trash" button.
  • Sort the trash by size, name, permissions, last modified, and type.
  • Select which files you want to remove and then select the "Delete" option at the top.

To remove all formerly deleted files, click the "View Trash" button and then use the "Empty Trash" button.

When the pop-up box pops up, confirm by clicking the "Empty Trash" button.

Sometimes, it might not be the files you deleted and sent to Trash that may be eating up your inodes and disk space.

The best to identify what is actually taking up space is to use the Disk Usage function in cPanel >> Files.

When the page loads, you will see all the information about your files, your directories, and which of these is using up large amounts of hard disk space.

 

How To Restore Deleted Files From The Trash Folder

If you have deleted a file and then later realize that you need it (or have accidentally deleted the file), you can restore the deleted files in "Trash" via File Manager.

From within the File Manager, click on the "View Trash" option.

How To View Trash in cPanel

Review the contents for the Trash directory and select either the file or files currently present there.

Click on the "Restore" to restore the file (or files) to its previous location.

How To Restore Files From cPanel File Manager

 

Removing Files via SSH or Terminal For cPanel

Log in to the server via SSH or access Terminal the icon either in cPanel.

WARNING: Please be super careful when using the command line to interface with your cPanel account.

You cannot recover a file or directory once it is deleted.

If you are not sure, use cPanel File Manager for this task.

Or test in a dev environment.

If on a production or live account, you may want to generate a backup of your entire cPanel account from the cPanel interface before proceeding.

Remember to delete the backup after you have completed your task.

$ ssh $username@$domain.TLD

This will land you in the account home.

But best practices dictate that you should always manually check your location:

$ pwd
/home/$username

Check the content of the Trash folder:

$ ls -al .trash

If there is a file (or files), you may wish to remove it or them:

$ rm -v ~/trash/$filename.txt or rm -v ~/trash/$zippedname.zip or rm -v ~/trash/$filename.php

To empty everything out:

$ rm -rfv ~/trash/*

This removes all files in the Trash folder but without deleting hidden (dot) files.

If you opt to remove everything including the hidden files, then: $ rm -rf ~/trash/{*,.*} $ rm -rfv ~/trash/{*,.*}

Confirm:

$ ls -al

 

How To Remove Unneeded Email Messages

As with everything in your web hosting account, removing old messages should be part of your monthly maintenance.

This is because your email space is part of your assigned disk space.

But more important is the fact that while you may have an unlimited disk web space, there is an inode limit to be considered.

To ensure a healthy email space, make it a habit to completely remove old emails by using the "Delete Permanently" option.

Not simply sending them to the Trash.

Steps To Remove Unneeded Email Messages:

  1. Log into your Webmail. E.g. https://webmail.$domain.TLD or https://$domain.TLD:2096
  2. Click on the pie chart with disk use information to access the interface:

    Roundcube Email Disk Storage

  3. Click on the "Manage" option on the far right next to the folder you wish to remove messages from.
  4. Select the option that describes what you want to delete.

    How To Manage Webmail Inbox in cPanel

  5. Click "Delete Permanently".

 

 

But there is another approach.

If you are using Apple, Google, or Microsoft accounts, you can configure all emails from your cPanel account to be sent to your Mail, Gmail, Outlook, or any other email client you are using.

We believe that these links will help:

 

How To Automatically Remove WordPress Trash

Deleting a comment, page, or post in WordPress goes into and is stored in the trash system.

This of course will take much of your website's database needed space if left uncleared.

You can set the number of days to auto-delete the items.

All you need to do is to add the line below to your WordPress's wp-config.php file.

define ('EMPTY_TRASH_DAYS', 7);

The above auto-deletes all trash every 7 days.

You can also disable the trash system so that nothing is saved:

define ('EMPTY_TRASH_DAYS', 0);

We hope you will find these tips on how to keep your cPanel hosting trash-free useful.

 

If you want to add to this tutorial or have found an error in it, please send an email to team+editorial@webhostingm.com


Did this answer help?

« Back