Archive for February, 2011

Adding a drive to a RAID 5 array

Followed the guide here: ubuntuforums.org/showthread.php?t=713936

Once again, LVM is awesome. Read the rest of this entry »

No Comments

Stopping mingetty from launching in a Fedora/CentOS/RHEL Xen VM

Set “ACTIVE_CONSOLES=” in /etc/sysconfig/init and reboot.

Remarkably simple, yet undocumented.

No Comments

Oh, hey. I’m late this year.

The Fate of Ambition

The Fate of Ambition

No Comments

Using LVM to move between drives

Finally got a pair of 500GB drives to do RAID1. So I needed to move from my single 300GB to a RAID1’ed 500GB pair.

For the dom0, I had to do a reinstall of Fedora. Since I would be booting off the drives, and I needed grub setup as RAID aware, it was just easier to reinstall + compile the kernel for dom0.

For the domUs, it was fairly simple where I had created a separate volume group for their logical volumes. First, create a volume group on the new hard drive (in this case, /dev/md126 since I was now using RAID) with vgcreate -s 32 domUs /dev/md126. (-s 32 means the extent size is 32MB. This must be the same as the extent size of volume group of your existing logical volumes are in, otherwise the volume group merge will fail!)

Then, merge the existing domU group with the new domUs group: vgmerge domU domUs (Put the volume group you want to merge into as the first option.)

Next, move the logical volumes onto the other drive: pvmove -v /dev/sda3 /dev/md126 This can be done online without bringing your VMs down, amazingly enough.

Then, once the move is finished, it’s time to remove the old drive. Do vgsplit -v domU domUs /dev/sda3 to isolate the old drive in its own volume group.

Then, do vgremove domUs to remove the volume group.

Finally, run pvremove /dev/sda3 to destroy the LVM label on the drive.

Technically the last two steps aren’t needed, but I wanted to keep the drive in while the VMs settle down, since a known-working install of Fedora exists on the other volume group on the drive.

1 Comment

find/xargs/grep tricks

Because xargs will die if you have an unescaped quote, but using -0 screws everything up if you’re reading a list of files:

sed s/\'/\\\\\'/|cut -d \: -f 1|xargs -i rm "{}"

The sed pattern will put the escape character in front of any single quotes so that xargs doesn’t screw up.

Using md5sum to compare files, use grep -v FAILED to quickly get a list of files that passed the md5 check.

Feed it into xargs to delete the files:

grep -v FAILED|sed s/\'/\\\\\'/|cut -d \: -f 1|xargs -i rm "{}"

,

No Comments

Allowing password-less SSH logins

Because I don’t care too much about what happens to my test servers, I’ve been setting up password-less SSH logins. Using a Linux system to login is trivial, because it’s a simple matter of doing

ssh-keygen

on the system that will be connecting to the remote server, and just hitting enter until the key is generated.

After that, it’s a simple

scp id_rsa.pub > host:/home/kyl191/.ssh

followed by

cat .ssh/id_rsa.pub >> .ssh/authorized_keys2

once you login to the remote server.

For Windows, it works with putty, but you have to use puttygen as well as convert the key it generates into a different form, so it’s more involved. But still works. ^^

Also, add the line echo “key_contents” > /home/$user/.ssh/authorized_keys2 to the kickstart file to automatically set every future installed system up to work with your password-less login.

No Comments