Converting software raid

If you accidentally set up a server with the wrong software raid type, as long as you used LVM you can use mirroring to temporarily move the filesystem off the RAID device, recreate the RAID properly, then move the filesystem back onto it. Needless to say if things go wrong during this process you’ll be reinstalling. Below is an example where md1 on sda2 and sdb2 is being converted from RAID0 to RAID1, and an iSCSI volume serves as the temporary storage. In it VG is the volume group name. LV is the only logical volume being moved, and DEVICE is the device linux creates for the iSCSI target. If doing this yourself, you’ll want to frequently check the sanity of what you’re doing with commands like ‘pvs’ and ‘lvs -a -o +devices’. If feasible, you can save a lot of time by turning off swap, removing its logical volume during the conversion, then recreating it afterwards.

Wwwaiter released

I’ve released a small perl script named wwaiter. wwwaiter is a program for visualizing delays in receiving portions of a document from a web server. It won’t be exact due to buffering done by your webserver and operating system, but it should help diagnose slow parts of web applications.

Nethook

I recently had a problem on CentOS 5 where the best solution I could think of required running a command when a network interface is brought up. I’m used to having this functionality as a part of the networking scripts on Debian-derived distributions, but I discovered that Red Hat-derived distributions lack it. I’ve written a small daemon called nethook to provide it. You can find the code and documentation for nethook on github.

Virt-install with kvm

If you are using virt-install to create KVM virtual machines on RHEL or CentOS 5, be sure to specify the ‘–accelerate’ option. If you don’t use accelerate, virt-install starts ‘/usr/bin/qemu-system-x86_64’ rather than ‘/usr/libexec/qemu-kvm’. This isn’t what you want, and it will fail with the error message “internal error Domain $YOUR_VM didn’t show up”. What happened in the background is that libvirt set the machine type to rhel5.4.0, which lets qemu-kvm know it can use virtio, but this machine type is not understood by qemu-system-x86_64. If you check ‘/var/log/libvirt/qemu/$YOUR_VM.log’, you’ll see a detailed error like \ \