Archive

Posts Tagged ‘centos’

Extend LVM with new physical disk

March 2nd, 2009 1 comment

LVM is a great tool for volume management. You can easily add a new (virtual) harddisk to a existing logical volume.
With fdisk -l you can see what devices are available. Choose the right one and execute:

fdisk /dev/sdb

Create a new partition which fills up all the free space with the type Linux LVM (HEX: 8e).
Then we create a physical volume for LVM:

lvm> pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created

After that we can extend the volume group with this new physical volume:

lvm> vgextend VolGroup00 /dev/sdb1
Volume group "VolGroup00" successfully extended

Then extend the existing logical volume with 100% of the free space from the new physical volume:

lvm> lvextend -l +100%FREE /dev/VolGroup00/os
Extending logical volume os to 27.84 GB
Logical volume os successfully resized

That’s all, the existing logical volume is now extended with the new harddisk.
If you have a ext3 filesystem on this logical volume you can extend this online using the command:

[[email protected] ~]# resize2fs /dev/VolGroup00/os
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/os is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/os to 7299072 (4k) blocks.
The filesystem on /dev/VolGroup00/os is now 7299072 blocks long.

Like I said before, this can be done on a online root filesystem without any problems. I’ve done it again this time. But always make sure to have a backup!

HP support pack on CentOS

February 7th, 2009 No comments

If you have CentOS running on a HP server you can install the HP support pack. On the HP site download the Redhat version.

First of all you need some rpm packages, this should be enough:

yum install rpm-build rpm-devel net-snmp glib kernel-devel
compat-libstdc++-296 make gcc

Than you have to edit the /etc/redhat-release file. First make a backup of the original file. Than place the following line in it:

Red Hat Enterprise Linux ES release 5

The version number must match the CentOS version, in my case this was CentOS 5.2.
After this you can easily start the installation by typing: ./install<versie>.sh -nui.

Extend a ext3 volume with LVM

February 7th, 2009 2 comments

If you have a ext3 volume on LVM you can easily change this volume.

When you want to extend a volume you can do this with lvextend.
To extend a volume with 10GB do the following:

[[email protected] ~]# lvextend -L+10G /dev/<volgroup>/<volume>
Extending logical volume <volume> to 14.88 GB
Logical volume <volume> successfully resized

After this you have to extend/resize the filesystem:

[[email protected] ~]# resize2fs /dev/<volgroup>/<volume>
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/os is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/os to 3899392 (4k) blocks.
The filesystem on /dev/VolGroup00/os is now 3899392 blocks long.

That’s all!
You can do this without any problems on a live root file system.

Less logging from snmpd

February 7th, 2009 No comments

The snmp deamon logs a lot to the syslog deamon on CentOS. Especially when you have some monitoring with the snmp protocol.

You can change this by editing the init options of snmpd. This options can be found in /etc/init.d/snmpd. Search for the rule starting with “OPTIONS=”

Example:

OPTIONS="-Ls d -Lf /dev/null -p /var/run/snmpd.pid -a"

You have to change this to:

OPTIONS="-LS 0-4 d -Lf /dev/null -p /var/run/snmpd.pid -a"

This says that you want to log everything with a priority above debug to the syslog deamon.

In CentOS and other Redhat distro’s you also can create a file /etc/snmp/snmpd.options and put the options line there.