General Housekeeping (and what to do if you run out of disk space and get database errors)

July 15, 2011 • Customer Services       
Synopsis

General housekeeping tasks for your CensorNet server

Article

There are certain tasks you can perform if you find your CensorNet server running low on disk space. It is also a good idea to perform housekeeping prior to upgrading or taking a backup.

 

Removing archives

First, whilst the CensorNet will automatically archive the live log after certain number of records, it never automatically removes the archives. These can build up and eventually the database may fill your disc space.

You can easily clear these down using Reports->Manage Archives via the web control panel. The most recent archive is listed first, earlier ones underneath. They show the dates of the first and last record in each. Simply delete the archives you no longer need to run reports against.

 

Vacuum the database

Secondly, over time, you will have added and deleted records to your database. A record that has been deleted is actually only marked as deleted, for speed, it is not physically removed from the database. You can clean up your database by typing these commands at the command line (as root)

su -c 'psql censornet' postgres

vacuum full;

This can take a while to run, so it is best to do it at the end of your working day.

When it has completed type Ctrl-D to exit the postgres database prompt.

 

How to clear the on-disk web cache (squid)

Finally, if you should run out of disc space, one quick way to retrieve some is to clear the web cache. Run these commands :

/etc/init.d/squid stop

cd /var/spool

rm -r squid

This can sometimes take a few moments. When the command prompt returns, type these commands :

mkdir squid

chown proxy.proxy squid

cd squid

/usr/sbin/squid -z

This last command can take a few moments to re-create the structure for the squid cache, then continue with:.

cd ..

chown -R proxy.proxy squid

Finally, you can restart squid with :

/etc/init.d/squid start

 

Backing up essential files

If during the course of you CensorNet installation you've had reason to modify system files such as the Access Denied templates, firewall rules or CensorNet XML configuration file, then you should back these up to avoid them being overwritten during an upgrade (and for good practice anyway!).

First of all, create a backup folder, e.g.:

mkdir /root/backups

Next copy the files to that folder:

1. For custom firewall rules

cp /etc/network/interfaces /root/backups

2. For the XML configuration file

cp /etc/cnv4/cn_proxy.xml /root/backups

3. For the Access Denied templates

mkdir /root/backups/templates
cp /usr/share/cnv4/templates/* /root/backups/templates

If you are not sure please contact Technical Support.

Related articles


Last modified on Sat, August 13, 2011 « Back