Category Archives: Linux Servers and Software

General Linux server and software information.

Adding disk space Debian Linux on VMWare

This is for an installation of Debian Linux (Lenny) that is run as a VMWare virtual machine on ESX server. The Debian install is also using LVM Logical Volume Manager. Refs: Overview at WikiPedia and the detailed How-To at tldp.org.

We had to increase the physical drive space on the debian system and while I verified some of what I planned to do with other sites I found a number of steps missing if I wanted to be ‘sure’ of being able to repeat the exercise.

Once the VMWare virtual disk had been allocated/increased I could start with the work inside Debian so it could use the space.

The first step was to install parted to manage the partitions as it makes it easy.

[php]# apt-get install parted[/php]

Next, because I want to run in single user mode I cannot use my favourite tool, PuTTy to connect as the SSH daemon will not be loaded. So I use VMWare client vSphere to connect and open a console.

[php]# telinit 1 [/php]

will restart in single user mode – you will need the root password for the server.

Start parted
[php]#parted[/php]

and use the command print free to list your drive(s) / partitions.
[php](parted)print free[/php]

which should display a screen similar to my completed example below. Once you can see the details of the free space you can use the resize command to increase the size of the extended volume. In this example my original part #2 was 21.2GB in size and this process increased it to the 107GB that was now allocated. The following steps will need to be adjusted for the specific system details.

[php](parted)resize
(parted)Partition number?2
(parted)Start? [255MB]?255MB
(parted)End? [21.2G]?107GB
(parted)print free[/php]

For my change the result of line #2 in this is correct as the partition is now approx 107GB in size rather than 21.2GB. In the next step I setup so that the logical volume #6 will be added.

Parted console after completing the addition of sda6 space

Once the extended partition is configured the server will need to be restarted.

[php]#shutdown -r now[/php]

Still using the VMWare console, as the startup screen appears the option to select single user mode will come up. If you miss it and start up in multi-user mode just use the telinit 1 command that we used earlier to return as single user mode.

Use cfdisk to view the disk setup.

[php]#cfdisk[/php]

This screen shows the completed sda6 logical drive.

Screenshot of cfdisk with updated partitions.

To allocate the free space arrow down to the free space and press the letter T for type. Select the type of drive that is required. In this example I selected 8E from the second page of types to use with Linux LVM.

Select Write from the command menu and yes to write the allocation table information for the new volume. In this case it is allocated as sda6.

Quit out of cfdisk.

At this stage if you are not using LVM on the server you will need to format the drive and add it into fstab, etc., however this server is using LVM and these are the next steps.

There are three levels Physical Volume, Volume Group, and Logical Volume. Using the lvm shell (good with help screens) or commands direct at the prompt (if you know what you are doing).

[php]#pvcreate /dev/sda6
#vgcreate new_volume_group_label /dev/sda6
#pvdisplay[/php]

Adds the Physical Volume (pv) into LVM while the vgcreate adds a new Volume Group (rather than extending the existing VG) and pvdisplay just presents the confirmation that its all worked.

[php]#lvcreate -L -n
#lvscan[/php]

Once created the logical volumes then need to be formatted or have their file system created.

[php]mke2fs /dev/lvname[/php]

Which creates the file system and then to add the journal setup

[php]tune2fs -j /dev/lvname[/php]

After this add the new drive into /etc/fstab with the relevant entries and directory(s) added.

One last reboot (or two if its wrong!) to check that it will all start up in single user mode and then a full restart and test in multi-user.

SugarCRM Timezones for Australia Daylight Saving

The default timezones in SugarCRM are driven by the file /include/timezone/timezones.php

With changes to the Australian Daylight Saving settings this year, the timezones.php file is incorrect.

As a side note, Trivia: When was DST first used in Australia and in which states did it apply? A: below….

All states that observe DST are now consistent in the application of dates etc. So excluding Darwin, Perth, Brisbane the other capitals can all be set for starting on the first Sunday in October and ending on the first Sunday in April each year… until they change it again!

The format for each of the cities is currently set as follows (SugarCRM 5.2.0g):
[php] 
‘Australia/Adelaide’ =>
array (
‘gmtOffset’ => 570,
‘dstOffset’ => 60,
‘dstMonth’ => 10,
‘dstStartday’ => -1,
‘dstWeekday’ => 0,
‘stdMonth’ => 3,
‘stdStartday’ => -1,
‘stdWeekday’ => 0,
‘dstStartTimeSec’ => 7200,
‘stdStartTimeSec’ => 7200,
),
[/php]
For Perth it needs to be changed to remove all DST settings leaving just the
[php]
‘gmtOffset’ => 480,
[/php]
All the other capital cities need to have the start date to the first Sunday in October and ending dates changed to April which is done by changing three values.

[php]
‘Australia/Adelaide’ =>
array (
‘gmtOffset’ => 570,
‘dstOffset’ => 60,
‘dstMonth’ => 10,
‘dstStartday’ => -1, 0,
‘stdMonth’ => 3, -1, 0,
‘dstStartTimeSec’ => 7200,
‘stdStartTimeSec’ => 7200,
),
[/php]
The use of -1 in the day field indicates the last in the month rather than 1st in the month.

This should apply to Sydney, Melbourne, Hobart, Currie*, Adelaide, Broken Hill.

A final note that applying these changes to a copy of the timezones.php and placing that under /custom/include/timezone/timezones.php does not work and you need to replace the original file in /include/timezone/timezones.php

*Where is Currie? King Island. Off the coast of Tasmania and at one stage they did not observe DST while Hobart did so they had their own setting. Redundant now.

Answer to the trivia Q: Summer 1916-1917 and it was Australia wide. It then was dropped until trialling again in 1942 – 1945 and at various other times over the next 30 years until broadly accepted around 1970 across eastern states.

Nagios error: /etc/init.d/nagios: line 60: /usr/local/nagios/libexec/check_nagios: No such file or directory

This error occurred for me because the nagios/cgi.cfg contained the incorrect settings.

This is on a Debian Lenny platform and I was not the original installer.  I initially thought it was the nrpe settings and spent sometime working out why the correct settings in the nrpe.cfg were not working. 

Apparently the cgi.cfg takes precedence over the nrpe.cfg, at least in my setup it did!

Linux upgrades

Updating 2 Linux servers from Debian Etch to Debian Lenny. Needed to clobber some old proxy settings in the apt.conf file. Then found some old settings in the sources.list file. Removed the non-US apt settings that are now defunct and changed all occurences of Etch to Lenny and saved.
#apt-get update
#apt-get dist-upgrade

…and other than a couple of prompts, magic happened.

Reboot and they are running.