Categories
Linux / Gentoo Linux

Networking for KVM with CentOS 5.5

I’ve found numerous tutorials to set up KVM with CentOS 5.5. Some refer to the Red Hat guides, which are useless in my opinion if you are not using KVM in a large server park, others come up with scripts to set up networking.

I kept searching and trying configurations until I finally found one that works. Note that among problems you might encounter is the one that plagued me for months: CentOS is attempting to bring up the virtual device for LAN access on the host before bringing up the physical interface, this fails and prevents all networking and dependencies from starting properly.

To set up the bridge devices for KVM and the host (something which is done only once to ‘wire’ your virtual network instide the bridge) look here. Most of the guide is still relevant even if they refer to the Red Hat documentation (which is about Red Hats cloud virtualisation platform and not a single server running KVM).

Use a configuration like this for proper KVM networking under CentOS, Red Hat and probably even Fedora.

1. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 to contain something like this:

1
2
3
4
5
6
7
# /etc/sysconfig/network-scripts/ifcfg-eth0 - the physical NIC which will not be used directly
DEVICE=eth0
TYPE=Ethernet
HWADDR=00:23:B3:16:3F:00
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no

The “NM_CONTROLLED” bit seems to originate from Fedora 12/13, CentOS might ignore it altogether so you could leave it out.

2. Edit /etc/sysconfig/network-scripts/ifcfg-br0 to restore network access for your host machine:

1
2
3
4
5
6
# /etc/sysconfig/network-scripts/ifcfg-br0 - Bridged network access for host
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
NM_CONTROLLED=no

The crucial parts in this configuration is that eth0 is started on boot and is assigned a bridge device: ‘br0’. The ‘br0’ device is marked as a bridge device which completes the dependencies between them. So make sure if you deviate from the examples you leave the types and ‘bridge=br0’ in tact.

Categories
Linux / Gentoo Linux

Growing LVM storage

After adding some new storage to the backup system at work, I needed a way to transfer the roughly 400GB of backups to the new installation – without the use of a USB disk or another server (would take way too long). So after installing CentOS 5.3 with LVM2 enabled, I dedicated the better part of 1TB to the new backup storage on the new hard drive.

After mounting the old storage, I copied the old archives to the new LVM storage and did the following.

Prepping partition for LVM

Use fdisk to change the partition type to ‘Linux LVM’, hex code ‘8e’: fdisk /dev/sdb

Then create the structure needed for use with LVM on the new partition: pvcreate /dev/sdb1

Finally, add the new LVM partition to the LVM caches by letting the automated scan picking it up: vgscan

Now to actually append the new partition to the storage pool: vgextend VolGroup00 /dev/sdb1

Adding to LVM

If you run vgdisplay, you should now see the space you just added as free space in the LVM storage pool.

You can now add the free space to one or more storage volumes that need it: lvextend -L +353.5G /dev/VolGroup00/LogVolBackups

Finally, let the filesystem on the drive resize to fill the new space: resize2fs /dev/VolGroup00/LogVolBackups

And there we go, 353.5GiB added to the LVM2 storage. Now next time I won’t think twice to use LVM2.

Categories
How-To's

HighPoint RocketRAID 1742 in CentOS 5.2

After having a bit of a fight with CentOS and its broken Realtek 8169 driver (called r8169 and which also claims Realtek 8168 devices but screw up when detecting the link status) I finally got to play with a RocketRAID 1742 controller from HighPoint. Where Promise dropped the ball with supporting hardware RAID on linux (basically you get 2 or 4 extra SATA ports but the RAID controller plays dead), HighPoint promised us true RAID under linux without any wonky software drivers.

Note that the RPM package for the DKMS rr174x driver is attached on the next page.