The beauty of LVM

July 7th, 2006

I was running low on disk space on one of my servers. Luckily I had set up LVM, was using XFS and had some room to spare on my physical volume. With just 2 commands I added 1GB of space to the filesystem.

root ~> lvextend -L+1G /dev/vg00/rra
root ~> xfs_growfs /usr/local/cacti/rra

I found out how much space I had to spare using the vgdisplay command.

root ~> vgdisplay
— Volume group —
VG Name vg00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 5
Open LV 5
Max PV 0
Cur PV 1
Act PV 1
VG Size 67.10 GB
PE Size 4.00 MB
Total PE 17178
Alloc PE / Size 9728 / 38.00 GB
Free PE / Size 7450 / 29.10 GB
VG UUID vYM9vS-mmUn-2JUm-GLJB-B1gk-dJ2r-FHuCZU

Looking at “Free PE” you can see I have 29GB to use on down the road.

To learn more about lvm, check out the HOWTO

Linux Quiz #003

July 6th, 2006

Panic! (Submit Answer)

Let’s say you are troubleshooting a remote system and have no physical access to the hardware. How would you ensure that you can regain control of the system if/when a kernel panic occurs?

Assume you have serial console access both during POST and after kernel bootstrap. There is more than one correct answer.

Roomba Lives?

July 6th, 2006

I recently acquired an open-box Roomba Discovery SE made by iRobot for $50. It seemed like a good buy, I could always hack it for a robot base if it didn’t work. The only thing missing was the fast charger.

Digging around in the various junk boxes that inhabit the dark corners of my basement yielded an old Gateway laptop adapter. At 19V and 40W it was “close enough for me” to the Roomba’s stated power requirements of 22V and 1.5A. I quickly disassembled the included home base charging unit to check the required polarity (center positive it seems).

After soldering on the appropriate size power plug I plugged in the home base charger. Lo and behold, I got a green power light! The Roomba, however, remained dark and silent. I stuck it on the home base and the docking light came on. Still no response at all from the Roomba.

Much to my delight the power button started pulsing red after about 30 seconds of charge. Yay! I gave it a few minutes and was rewarded with some plaintive beeping when I attempted to power on the Roomba. There was hope! A few hours of charging and the little Roomba was running around proudly cleaning up bits and pieces from my carpet under the workbench.

I have now been using the Roomba for a couple of days and am quite impressed. The navigation logic is bang on and even does a fine job in our living room with a large sectional, coffee table and several other obstacles. The battery life is not too good, 30-45 minutes of cleaning on carpet. It does seem to be improving with every charge, so perhaps the battery just needs some conditioning.

Here are some links I have come across in researching the Roomba series.

Perl GetOpt Not Working

July 6th, 2006

I have run into this same problem a few times so I am documenting it here. When using GetOpt::Long and friends I would be mystified when the options were ignored. For example:

#!/usr/bin/perl

use strict;
use warnings;
use Getopt::Long;
my $debug = 0;

my $result = GetOptions( "debug" => $debug );
print "Debug flag is $debug\\n";
wriley ~/bin> ./getopttest.pl
Debug flag is 0
wriley ~/bin> ./getopttest.pl --debug
Debug flag is 0
wriley ~/bin>

The options are completely ignored! A short time of googling later and I remembered the solution.

#!/usr/bin/perl

use strict;
use warnings;
use Getopt::Long;
my $debug = 0;

my $result = GetOptions( "debug" => \\$debug );
print "Debug flag is $debug\\n";
wriley ~/bin> ./getopttest.pl
Debug flag is 0
wriley ~/bin> ./getopttest.pl --debug
Debug flag is 1
wriley ~/bin>

The key is escaping the $ in the GetOptions() statement. If you don’t escapey, it don’t workey!