Saving Disk Space

Posted on December 28, 2007
Filed Under cPanel Web Hosting, Web Hosting | Leave a Comment

save disk space in your cpanel hostingHow to save on disk space in your cPanel hosting account

There will come a time when you come to reach the limit of your web space, upgrading is always an option but we recommend you undertake a space saving exercise first, you may be surprised at how much space you can retrieve by following some simple steps …

Optimise those Images

Probably one of the best pieces of advice on saving space … optimise your images before use in your web pages. Only ever upload properly optimise images, the space saved can be very large indeed. When you otpimise try to aim for a reasonable file size that will aid speedy page display as well, whilst most of the planet is on Broadband, there is still a substatial amount of people still using much slower connections and of-course there are the mobile browsing devices we see so much of now.

We recommend that you aim for a maximum file size of 75kb for large images (more than 800 x 600), 50kb for medium sized images (from about 200 x 200 pixels up to about 800 x 600 pixels) and less than 25kb for smaller images, and then less than 5kb for things like buttons and repeated background images. These figures amy seem a bit idealistic but the effects on users’ browsing experience is noticeable and it will save substantial amounts of space.

In addition, consider the best file type for the image for the best optimisation while retaining good quality. Things like photographs should always be optimised as jpg or jpeg ~ this file type is best suited to maintain the quality of the image. JPG files can be further shrunk by applying a ‘progressive browser display’ optimisation (which has the effect of initially producing a blurred image as it loads to a crisp and clear one). Things like illustrations or cartoon like graphics should always be optimised as GIFs. Try to avoid PNG files as they are notoriously large and do not optimise as well as JPGs and GIFs, and BMP files are usually much larger again.

The best program for optimising GIFs is by far Marcomedia’s Fireworks, and the best for optimisation of JPGs is by far Adobe’s Photoshop, but both come with such an immense price tag so one has to consider the economics of the small investor, in which case PaintShop Pro is a very suitable option for both GIFs and JPGs. If your budget is that low that you cannot afford a graphics program to do the work for you then there are of-course some reasonably good free online image optimisers (,GGLG:2005-41,GGLG:en&q=free+image+optimisation).

Once you done this, don’t forget to check your page weight (see how large the page size including all code and images) by using a good free online web page analyzer.

Compress files for user download!

Many sites offer free or paid file downloads, if you do this, you should ensure that all download files are compressed, zip being the most popular format. Use a good compression program (such as WinZIP) to compress these files before offering them for download, this will save on space and bandwidth.


Yes, emails do take up disk space, albeit not necessarily a lot, depending on the content of the emails, but if you allow them to build up on the server they will take up a noticeable amount of space over time.

So always ensure that you have set your mail program to download emails and then delete them from the server. Also, keeping sensible quotas on email accounts is a must, not only to ensure that you can conserve space (you will get usage warning as your mailboxes reach their limits giving you time to take corrective action by deleting old and unwanted emails) but will help to prevent any flooding attacks (where spammers/spoofers use your email address to send spam to or to spoof in fake emails they send out to other Internet users). With a flooding attack you can end up receiving hundreds or thousands of unwanted emails in a very short space of time, so reaching your full space allocation can be avoided by setting sensible quotas on your mail accounts (use the ‘Email Accounts’ link in the ‘Mail’ section of your cPanel to change quotas on each mail account).

The other thing you should always avoid is setting a default address to collect unrouted mail (see our Blog entry on Preventing Mail Server Attacks for more).

Clean out unused files and images

Many of us change our site layouts and forget to remove files or images that are no longer in use, always try to do this whenever you make any page changes. Some HTML editors/FTP programs offer a synchronise facility (such as Dreamweaver) which will produce a report detailing file son the web server which are not in use by the current published pages and allow you to then check against those that you do not wish to keep. Removing those unwanted files and images can help save considerable space since most of your space will be taken up by these kinds of files be they in use or not.

Employ good coding practices

We should always code with conserving space and enabling easy updating in mind. Using HTML and CSS is one such good practice, with CSS you can prevent the necessity to duplicate code in your pages thereby keeping page code and subsequently file size to a minimum. A CSS style sheet (CSS = Cascading Style Sheet) can be used over and over for many pages, thus saving space and making it easier to update multiple page content and design or layout.

Dynamic content is another space saving tip that should not go unmentioned. Like CSS, using MySQL to save and reproduce page content is a great idea to produce dynamic content (this is how the various content management systems [CMS] work, such as PHP-Nuke, Mambo, etc). This again keeps file sizes to a minimum while allowing you to offer a much wider range of pages built on the fly rather than storing the entire page content as one static file.


Whilst a good web host would always maintain on server backups that do not count as part of your web space, web site backups generated by the user do count and can take up more space than any other thing mentioned in this article. We should always endeavour to download any backups we create and then delete them from our web space. Whilst backups are compressed, the level of compression is always limited as with any file or files, you could be looking at a file size of around 70% of the original when compressed, so a backup left in your web space (which let’s say is taking up 50mb of your 100mb space allocation, now add a full backup which is compressed to about 70% of its original size which would be about 35mb, so we now have 85mb usage of the 100mb allowed) will consume space.

Web Stats

Access logs are generated in real time as visitors come to web pages and each of the stats program that you have enabled in cPanel will also generate their own form of stats each day (during the server stats run) using those access logs. These stats can take up quite a lot of space, so we can look to saving this space by first deciding which stats program we want to use regularly (using only one will help to conserve quite a bit of space). To do this go into your control panel, then click on the ‘Choose Log Programs’ link in the ‘Logs’ section.

Decisions decisions …

Which stats program should you choose? We recommend AWStats as it presents a very user friendly interface with well laid out and comprehensive stats information. You may have another preference but take your time to look into each stats program and see which one you feel better with. Once chosen, simply uncheck the tick boxes under each stats program that you do not wish to use any more and click save to keep the changes. You will also notice that you can make separate choices for each sub or addon domain, you could even have different stats for each sub or addon domain.

Raw Log Files

The next thing is to deal with how the server handles your Raw Access logs, now these are used to build user friendly stats by using the aforementioned stats programs, so we do not necessarily need to keep these log files which count towards your total disk usage. This is not to say that the raw access logs have no other use, they can be very useful for pinpointing specific access records pertaining to let’s say a particular IP address, or a particular file. You can use raw access logs with the many log analysis programs that are available (such as Alterwind’s Log Analyzer Lite). In this case we need to download the log files once they have been fully created.

Go into your control panel and click on the ‘Raw Access Logs’ link in the ‘Logs’ section. We are now faced with the options page for your Raw Access Logs, now we need to make some decisions. Do you want to be able to analyse the raw access logs, remember that these logs are used to build the various web stats programs in your control panel, so you could easily see no need for them, but as said before these logs can be very useful for more detailed analysis by desktop based stats analysis programs (which can produce customised and detailed analysis files for you).

So if you do not want to keep them uncheck the first check box called ‘Archive Logs in your home directory at the end of each stats run’ this will prevent the raw access logs being kept when the web stats program(s) you have chosen are run each day. However, if you want to keep the raw logs for later analysis, keep this check box ticked.

raw access log optionsThe next option called ‘Remove the previous month’s archived logs from your home directory at the end of each month’ allows you to select whether the raw access logs are kept month by month. So if we check this option, the previous moth’s raw logs will be erased form the server, saving some disk space for you. If unchecked these raw logs will collect over time, each and every month to be precise.

We recommend that you select both options as it gives you the opportunity to not only use the raw access logs but also to save space by deleting the previous month’s raw logs (giving you the option to download them).

Continuing on the same page in your cPanel, we will see links to download the current month’s raw access logs, these will be compiled after each stats run and you can use these links to download to your local computer for use with a web stats analysis program (as previously suggested). Downloading them gives you the opportunity to then remove any that you no longer need to have on server, thereby saving more disk space in your hosting account. This is up to you to decide, but these raw access logs will always be available for download so long as you have the option Logs in your home directory at the end of each stats run’ ticked. If you don;t need or want to see these raw access log download links then simply uncheck that option (be aware though that you will then only be able to view your stats by using your cPanel and the stats program you ahve elected to use therein).

Avoid Errors

This tip gets little by way of mention; keeping errors to a minimum is useful in not only preserving web space usage (remember that each 404 error for instance ~ Page Not Found Error ~ will generate a log entry). 404 errors may not count for much on an individual basis, but a plethora of them can, so we need to avoid these. Common 404 errors are caused by missing robots.txt files (the files that search bots look for before crawling a site, and they will look for on each site, domain and sub-domain), missing error pages (yes that’s right an error means that an error page is always requested to explain the error, be that a 400, 401, 403, 404 or 500 error ~ so one error can generate two error records in the logs) and missing favicon files (the little image beside the URL in the browser address bar ~ browsers will request this each time they visit a page or a page is added to the favourites).

So, the first step should be to compile simple error pages, in cPanel click on the ‘Error Pages’ link in the ‘Advanced’ section and selet each domain you ahve hosted and create each of the error pages listed. cPanel is intuitive in this respect and offers to include page variables to report in the browser which is probably of more use to the user than they are to the webmaster. So keep it very simple and subsequently keep the page file size very small. One error page generated in this way will save much space in the web logs over time.

And, always make sure you have a robots.txt file for each and every site and sub-domain, it can be empty if you don’t want to use any robots.txt directives, but it will still prevent those wasteful error records in your stats logs.

Finally, create one single favicon for each site (unless you really want to use the same one for all sites) and code your pages to call that in your head tags using an absolute URL …

<link rel=”SHORTCUT ICON” href=””>

Creating this tiny little graphic is no mean feat, and we would recommend that you take the simple step of using a free online favicon generator.

If you have your own space saving tips, please leave a comment detailing them.





website promotion