Tweaking ClarkConnect

The ClarkConnect standard installation works fine, but I've compiled a list of the adjustments I've made that improve the performance of the system to more my needs, these include:

 

Shutdown using the Power Button

Pressing the power button to shutdown a computer is always a bad thing to do, to properly shut down the system you must either log into the web interface and browse to 'Tools - Shutdown/Restart' or log in via PuTTY and enter the following:

shutdown -h now

This is a real problem especially as you will most probably have to power up one computer just to power down the other. A very useful tool can be installed that automatically runs the shutdown command for you when the Power Button is pressed safely shutting down the server.

Login in as root using PuTTY and type:

apt-get update
apt-get clean
apt-get install acpid

When you reboot you will find the power button now properly shuts down your computer.

(If this fails to work, it could be that your hardware doesn't support the Advanced Configuration & Power Interface (ACPI) standard - check your motherboard's BIOS settings and make sure it's switched on.)

ACPID can be configured to run other scripts when acpi events occur, the configuration file is found at /etc/acpi/events/sample.conf if you fancy developing this further.

Automatic system shutdown

To set you system to shutdown automatically (who needs the system to be powered up over night?) you can create a 'cronjob' to closed down the system.

(My Via ITX motherboard supports auto power-on through the BIOS, so I've set it to power up first thing in the morning)

Login with PuTTY and enter:

crontab -e

You will be presented with the vi editor (which isn't very friendly)...

Press the 'a' key to enter the text mode

Enter the following line:

45 22 * * * /sbin/shutdown -h now

Return to the command line by pressing 'Esc' key

Save the file by entering:

:w

Exit the editor by entering:

:q

To check the file enter:

crontab -l

The above example shuts the system down at 22:45 (10:45pm), adjust the values to suit your requirements.

Spin-down the hard drive when not in use

This will not work with the drive containing the operating system as its mounted with the ext3 file system that journals (writes to the disk every few seconds). The additional hard drive I used for file storage (see Adding Extra Hard Drive) was mounted as an ext2 file system, so is suitable for spinning down.

With WinSCP double click on the '/etc/rc.d/rc.local' file to edit

Add the following line:

/sbin/hdparm -S120 /dev/sda

This script is ran at boot and sets the spin-down time of the /dev/sda drive (obviously change the command if you drive location is different, see Adding Extra Hard Drive).

The drive will now spin-down after 10 minutes of inactivity (120 x 5 seconds = 10 minutes)

See here for an example

Stopping a 2.5" laptop hard drive 'clicking'

If you have used a 2.5" laptop drive for you operating system, you might find that it 'clicks' shortly after it has been accessed (the operating system accesses the hard drive quite regularly on my system), I'd recommend you follow this tweak as it could prevent the premature failure of your hard drive...

The cause of the clicking is due to the very aggressive Advanced Power Management (APM) option on some portable hard drives unloading the read/write heads shortly after the disk becomes idle. (It reduces the power requirements and minimises the chance of damage cased by external shock - which is important for the hard drive's target use, e.g. in a potable computer).

This is probably fine if you have a laptop running Windows, but on a server running Linux the drive's typical 600,000 maximum unload/load cycles could be exceeded in well under 1 year of use with the journaling ext3 file system.

For more information see this link.

The simplest way to sort this out is to turn off the APM and prevent the drive constantly loading/unloading the read/write heads (this shouldn't be detrimental to the drive in any way, it will just use slightly more power):

With WinSCP double click on the '/etc/rc.d/rc.local' file to edit

Add the following line:

/sbin/hdparm -B255 /dev/hda

This script is ran at boot and disables APM on the /dev/hda drive.

You should now have a quieter hard drive that will last significantly longer!!

Keyboard missing error

After disconnecting the monitor and keyboard after the initial installation, the system insists on looking for it during the boot sequence which results in a hang for 30 seconds and reports a 'kudzu' error in the boot log.

To remedy this, login with PuTTY and enter:

/usr/sbin/kudzu

Press a key and then select the second option to "Keep Configuration" for the keyboard profile - no more errors and the system boots 30 seconds faster too!!!

Reduce hard drive activity when server is idle

The hard drive is accessed regularly to write log files and update files attributes, this activity can be significantly reduced with a couple of tweaks to the fstab and syslog.conf files without affecting the proper operation of the server.

Every time a file is read the file's attributes are modified to record the time of access, so if the file is in memory (as most of the Linux operating system is) this results in the hard drive being written to. The file access time attribute isn't (normally) required, and can be turned off by modifying the drives mounting instructions using the noatime option.

To set the noatime option for the hard drive, login with WinSCP and double click on the '/etc/fstab' file to edit it and modify the first line to this:

LABEL=/    /    ext3    defaults,noatime    1    1

See here for an example

The system is set to record various log files at regular intervals, causing regular hard drive activity. These are useful and probably shouldn't be turned off; a better option is to set the logs to be stored in memory and only "synced" to the hard drive when the system is powered down.

To edit the system log configuration file, login with WinSCP and double click on the '/etc/syslog.conf' file...

Add a " - " before the destination of the log file, for example the entry for the cron log file becomes:

# Log cron stuff

cron.*                        -/var/log/cron

This can be repeated for all the log file destinations in the syslog.conf file.

See here for an example

These two modifications extended the time between hard drive activity from ~30 seconds to several minutes...