Category Archives: Linux

Optimizing Zimbra Servers CPU Wait Time

CPU stat illustration

CPU stat illustration

Yesterday, I was complained about our mail server’s performance.

At first, I checked the disk space and everything’s OK. From server statistics, I found that the processed messages (sending and receiving) was about a hundred per minute.

Then I checked the load of the server using top command, and the result showed that the CPU wa percentage was quite high, about 30 to 60 %.

Based on some references on the internet, it mainly was caused by amavisd service which is doing read and write operation  from and to disk. It’s better to change the location of amavisd temporary folder (/opt/zimbra/data/amavisd/tmp) to RAM disk.

 

Then I did these steps:

  1. zmcontrol stop as zimbra user
  2. Add the following line to /etc/fstab:

/dev/shm /opt/zimbra/data/amavisd/tmp tmpfs defaults,size=200m,mode=700,uid=2003,gid=2000 0 0

 

Explanation:

/dev/shm : the RAM disk device

/opt/zimbra/data/amavisd/tmp : the mount point (amavisd temporary folder)

size=200m : folder size

mode=700 : only zimbra user can do read, write, and execute

uid=2003,gid=2000 : UID and GID of amavis (usually same to zimbra user)

 

After restarting the server and starting the zimbra services (zmcontrol start) I found that the CPU wait time  now is about 5 to 20% and the performance seems better and faster 🙂

 

Reset (forgotten) SLES 11 root password

Here’s a simple way to reset your Suse Linux Enterprise Server 11.

1. Boot your server until the boot options page

2. On boot options page, select Failsafe mode and add this to the end of the boot option:

init=/bin/bash

EasyCapture6

3. After that, you will get the root shell. Just type passwd command and set your new password.

booting

PHP Warning: ‘It is not safe to rely on the system’s timezone settings’ when using date() function

If you get this error on your PHP baseb web application, this means you haven’t set your timezone in your PHP environment. So the date() function will use time information from your OS timezone.

To prevent this error, just open your php.ini file, change the parameter:

; date.timezone

to (depends on your location, for example Jakarta):

date.timezone = 'Asia/Jakarta'

Save, and restart your web server daemon.

Can’t locate Date/Format.pm error in vlogger

Have you ever found this error in Apache’s error log file ?

Can't locate Date/Format.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8) at /usr/sbin/vlogger line 147.
BEGIN failed--compilation aborted at /usr/sbin/vlogger line 147.

This error causing your error log file have a huge size.

This appears because you haven’t install the perl Time and Date modules.

To solve this problem,follow these steps to install everything needed:

Install epel repos (for CentOS 5):

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm

Install perl-Time* modules:

yum install perl-Time*

That’s all 🙂

Adding More Space for My Servers Root Partition

GParted

Today, when I checked my servers disk space, I found that the root (/) partition is almost full. So I have to clean some unused files or add more space.

First step, I cleaned the /var/spool/mail/root because its size was very large. The command is

#cat /dev/null > /var/spool/mail/root

Second, I added more disk space by shrinking /home directory which is not highly occupied.

  • I downloaded the GNU Partition Editor (gparted), burned the iso file into CD, and then booted it in the server. Select the GUI mode.
  • Click the Gparted icon in the Desktop
  • select /home partition
  • insert the new lower size and click apply
  • there will be an unallocated space, click this and add new partition button, select ext3 filesystem and then click apply
  • close gparted interface, click exit icon, choose reboot, and press OK
  • remove the CD from the server

After that, I boot the Linux OS from disk, and then mount the newly created partition to /var directory, becase I think it will need a large disk space.

ssh root@myserver
mkdir /xvar
mount -t ext3 /dev/sda6 /xvar
rsync -av /var /xvar
umount /xvar
mount -t ext3 /dev/sda6 /var
rm -r /xvar

To make this permanent, add this line to /etc/fstab

/dev/sda6 /var ext3 defaults 1 2

Now, have more disk space in my servers root partition 🙂

%d bloggers like this: