Finding out why a hard drive, member of software RAID 1, failed

Today we've received the following message from mdadm monitoring on one of our servers:

This is an automatically generated mail message from mdadm running on host.website.tld

A Fail event had been detected on md device /dev/md126.

It could be related to component device /dev/sda.

Faithfully yours, etc.

P.S. The /proc/mdstat file currently contains the following:

Personalities : [raid1]
md126 : active raid1 sda[1](F) sdb[0]
1953511424 blocks super external:/md0/0 [2/1] [_U]

md0 : inactive sda[1](S) sdb[0](S)
6056 blocks super external:imsm


Disable Named in chroot and remove chroot partition

The recent versions of bind recommends the chroot environment for better security. When considering the most used popular Linux distribution ‘Red Hat’, they ship a package called ‘bind-chroot’ for the chrooting of bind. By default the bind or named daemon runs in a chroot environment.

But users who want to run ‘named’ in the old fashion may do so by disabling the ‘chroot’ environment. The ‘chroot’ing feature can be disabled by commenting out the directive ‘ROOTDIR=/var/named/chroot’ in the file ‘/etc/sysconfig/named’ and then restarting the ‘named’ service.

df -h


How to install IonCube loader on CentOS 6.3

Download and uncompress the latest IonCube version:

wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz # 32 bit
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz # 64 bit
tar xvfz ioncube_loaders_lin_x86-64.tar.gz

Then we go to the new IonCube source directory:
cd ioncube/

Move ioncube_loader_lin_5.3.so:
mv ioncube_loader_lin_5.3.so /usr/lib/php/modules/

Now edit /etc/php.ini and add the line zend_extension = /usr/lib/php/modules/ioncube_loader_lin_5.3.so


Another MySQL daemon already running with the same unix socket.

After upgrading to CentOS 5.6 MySQL deamon on my server didn't want to start complaining about Another MySQL daemon already running with the same unix socket. Firing up service mysqld restart didn't help. So I had to

rm -rf /var/lib/mysql/mysql.sock
service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]


How to install wkhtmltopdf on CentOS?

First, we need to know which version of wkhtmltopdf binary - 32bit or 64 bit- we need. To do so run this command in CLI:

getconf LONG_BIT

Now depending on the version of your CentOS dowload the first or the second link respectively for 32 and 64 bits:

cd /usr/src
wget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-i386.tar.bz2
wget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2

Install necessary packages:

yum install xz urw-fonts libXext openssl-devel libXrender


Creating and mounting swap in SSH

Some server that I am working with has no swap space mounted in the server. Swap is necessary as backup of our physical memory in case system needs more memory than what it has at that time and also increase application loading speed especially when starting and closing application.

Swap space can be setup in 2 ways, as partition or as a file. Since this server is already online and I have many free partition left in “/” partition, so it may good for me just to create swap file rather than swap partition.

My variables as below:

OS: RHEL 5.7 64bit (Tikanga)


How to change custom CentOS kernel to stock CentOS kernel

First, install the stock Centos kernel via yum. Write down the version it installs!

yum install kernel

Check in /boot if the files are there:

ls -al /boot

You should see "vmlinuz-2.6.32-279.19.1.el6.x86_64" and "initramfs-2.6.32-279.19.1.el6.x86_64.img"

Then, check your root partition, and write it down. Look for "/", and write down the filesystem (/dev/md1 in this example)
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 20317384 997168 18296272 6% /


Fix for Centos 6.3 Software RAID not loading GRUB on /dev/md0

If you’ve just installed CentOS 6 on software RAID and it won’t boot off /dev/md0, try the following:

1. Using your CentOS install media, boot in to rescue mode
2. Once you are booted in to rescue mode, select the “start shell” option
3. Enter the following command:

chroot /mnt/sysimage

4. Re-install GRUB

grub-install /dev/md0

5. Reboot


How to solve "iptables: Resource temporarily unavailable" error

If you see "iptables: Resource temporarily unavailable" error when restarting Advanced Policy Firewall (APF) on your Linux server, then take the following steps:

1. Add up some more RAM memory to your box
2. Reload your iptables:
/etc/init.d/iptables reload

3. Make sure your iptables get restarted without any errors:
service iptables restart

4. And finally restart your firewall:
apf -r

How to reset Webmin root password?

At times we often forget the webmin password for a given user, say root, or after repeated failed login attempts webmin locks the account and one cannot login anymore. In this case you need to wait for couple, three minutes and you will be able to try to login again. However, if you've forgotten your password and need to change it, then login to the server via ssh and run the following command:

For RHEL/CentOS:

/usr/libexec/webmin/changepass.pl /etc/webmin root NEWPASSWORD

For Debian/Ubuntu

/usr/share/webmin/changepass.pl /etc/webmin root NEWPASSWORD


Subscribe to RSS - centos