Diary of a geek

May 2007
Mon Tue Wed Thu Fri Sat Sun
 
     

Andrew Pollock

Categories

Other people's blogs

Subscribe

RSS feed

Contact me

JavaScript required


Monday, 28 May 2007

From the horse's mouth...

Just in case Ben Fowler doesn't read Planet Debian, Eric Dorland has written a much more detailed and accurate account of the Iceweasel situation than I did.

[17:07] [debian] [permalink]

Sunday, 27 May 2007

LVM, you've done it again

The good thing about having kept a blog these last few years, is I have a searchable record of hardware changes.

Recently, I noticed a few disk errors on caesar, and I was wondering how old that disk was. I disk some searching, and found via this post that the disk in it was a hand-me-down from when I decommissioned daedalus Mk I. One of the reasons I decommissioned it when I did, was the RAID-1 was exhibiting some strange errors during resynchronisation, and I didn't want to leave the country leaving behind an ageing problematic server with my stuff on it.

I'd previously been unable to fault either 120 Gb disk under some light testing with badblocks, so I just reused them, and so around October 2005, I put the larger disk in caesar. So this disk has seen a fair bit of use, originally in daedalus, and then in caesar for another 20 months. It's allowed to fail, it's served me well.

Anyway, so I bought a 750 Gb drive a couple of weeks ago, because one thing that I've wanted to do with caesar was do remote backups of daedalus, and there just wasn't enough space to do that, so I went for as big as I could find, and essentially repeated the same trick as last time, to upsize:

  1. Power down, attach new disk as a slave
  2. Boot into single user mode
  3. Unmount everything, remount root read-only
  4. sfdisk -d /dev/hda | sfdisk /dev/hdb to copy the partition table (I use a root, swap, LVM, three partition layout)
  5. dd if=/dev/hda1 of=/dev/hdb1 bs=1M to copy the root filesystem to the new disk
  6. mkswap /dev/hdb2 to put the swap signature on what will become the new swap device
  7. cfdisk /dev/hdb and blow away the third partition and recreate it using all of the available space (there's probably a programmatic way of doing this, but hey, it's not exactly hard to do in cfdisk either)
  8. pvcreate /dev/hdb3 to put an LVM signature on the new LVM physical volume
  9. vgextend base /dev/hdb3 to tell LVM there's two disks in the volume group for the time being
  10. Remount the root filesystem read-write
  11. rm /boot/grub/device.map and run /usr/sbin/grub-install /dev/hdb to install GRUB in the MBR of what will become the new boot disk
  12. Power down, swap the disks around so that the new disk is now primary and the old disk is now the slave
  13. Boot into single user mode again, unmount everything except root
  14. pvmove /dev/hdb3 /dev/hda3 to relocate all of the allocated physical extents off the old disk onto the new one
  15. Twiddle thumbs for a couple of hours. Admire artwork on computer's motherboard (did you know Compaq EVO's have a picture of a car on their motherboards? A map of Texas?)
  16. vgreduce base /dev/hdb3 to take the old disk out of the volume group
  17. pvremove /dev/hdb3 to remove the LVM signature from the old disk
  18. Power down and remove the old disk
  19. Reboot into multi-user mode and profit from all the additional free physical extents

I absolutely love how I can do this with LVM, with a minimum of fuss. Last time I did this, I had a kernel panic during the pvmove, but that didn't even stop it, I just rebooted and reran the pvmove and it carried on from the last checkpoint. No such excitement this time.

I'm sure Solaris' ZFS does all of this with substantially less manual steps, but hey, I like my Linux :-)

[18:01] [tech] [permalink]

Tone down the hate

Ben Fowler has a bit of rant about the Iceweasel situation in Debian.

Take a chill pill, Ben.

As I understand it, from when I recently had dinner with Eric Dorland, the problem is no longer the name Firefox(tm), but the fact that the logo is non-free. I think we're required to ship the logo with the product if we call it Firefox.

I believe that Ubuntu is glossing over the non-freeness of the logo. Heck, they're free to not be bound by the Debian Free Software Guidelines, they're not Debian. I think the Mozilla Corporation granted permission to Debian to redistribute the logo, but that permission wouldn't flow on to derivatives, so didn't really cut the mustard.

I'm sure Eric will correct me if I've said anything fundamentally incorrect.

In summary, sure, the whole Iceweasel situation is suboptimal, but I don't believe it exists for the reasons you feel it does.

[17:16] [debian] [permalink]

Saturday, 26 May 2007

Finding out just how hot the linen cupboard is...

I decided to move the old 1-RU Pentium III server (the thing providing all the storage for my MythTV box via ATAoE) from under the bed in the spare room to the linen cupboard. It had a brief stop in the wardrobe in the spare room, but it didn't really help with the noise.

Sarah was a concerned about the heat in the linen cupboard, as this is where the patch panel is, so caesar is already in here, along with an Ethernet switch, an ADSL modem, a wireless access point, and the Vonage ATA. There's a lot of DC plug packs generating heat, so it was a reasonable concern.

I figured in this day and age, someone must make some sort of USB temperature sensor, and after some searching around, I discovered the DLP-TEMP-G, which seemed to be about the right price, doing what I wanted.

I'm going to say the web page was a bit ambiguous, but it was probably just late at night, because I read the bottom as having the option to buy it from Mouser, or via PayPal directly with DLP Design. So I went down the latter path, because I generally prefer to deal directly with the manufacturer. Turns out what I was actually ordering was just a "Test Application", so that email I'd received the day after I placed my order for two units was all I was going to get. I figured this out after a week or so of wondering when it was going to arrive.

They were really good about it, and refunded me my $40, even though I'd received said software, and I placed a new order with Mouser for what I really wanted.

Now this time, I just didn't read things thoroughly enough, although I'll still say that things were a little ambiguously worded. The page I've linked to above does say "DLP-TEMP-G and 1 DS18B20 sensor $25.00", but when reading datasheet, it goes on about three sensors, and coming with one that isn't soldered on so that you can optionally run a cable between it and the board. I somehow interpreted this as meaning there were two sensors on the board, and one loose. Not the case. The board supports having up to three DS18B20 sensors attached to it, however you please. It comes with one unattached. In hindsight, why would you want two temperature sensors directly on the board?

So the moral of this story is I just can't read.

Anyway, I got home from Santa Monica last night, and the goods had finally turned up, so I had a play. The DS18B20 just looks like a transistor. I initially ignored it, and just shoved the USB board in caesar, and it happily recognised it

usb 1-1: new full speed USB device using uhci_hcd and address 8
usb 1-1: configuration #1 chosen from 1 choice
drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device
ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0
usbcore: registered new driver ftdi_sio
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver

I then fooled around with minicom, and discovered that the little transistor thing I'd been ignoring was indeed the temperature sensor, as I got a reading of zero back (when using this program I found on the 'net).

So I went to bed, and this morning did a bit of messing around with the sensor, and with a bit of creative bending, I've got it sitting in the S1 holes without requiring any soldering. It tells me the linen cupboard is about 44 degrees Celsius. Warm, but I don't think it's in any immediate danger of bursting into flames. Wouldn't surprise me if some of the gear in there isn't too keen about the temperature though. At least we won't have to worry about mold.

Next step is to convince cacti to graph it, and nagios to monitor it, and we're in business.

Here's a little Python program I knocked up to grab the temperature. pyserial is nice.

try:
  import serial
except ImportError:
  print "This program requires pyserial,", \
    "try checking the python-serial package is installed"

from optparse import OptionParser

SENSOR_QUERY_CMD = (None, 'S', 'T', 'U')
USAGE = "usage: %prog [options] [action]"

parser = OptionParser(USAGE)
parser.add_option("-F",
"--fahrenheit",
action="store_false", 
  dest="use_celsius",
  help="Output temperature in degrees Fahrenheit", 
  default=False)
parser.add_option("-C",
"--celsius",
action="store_true", 
  dest="use_celsius",
  help="Output temperature in degrees Celsius", 
  default=True)
parser.add_option("-d",
"--device",
action="store",
type="string",
  dest="device",
  help="device to communicate with", 
  default="/dev/ttyUSB0")
parser.add_option("-s",
"--sensor",
action="store",
type="int",
  dest="sensor",
  help="sensor to query",
  default="1")
parser.add_option("--mrtg", action="store_true",
  dest="output_mrtg",
  help="Output decimal value suitable for MRTG",
  default=False)
(options, args) = parser.parse_args()

if not(options.sensor > 0 and options.sensor <= len(SENSOR_QUERY_CMD) - 1):
  parser.error("Invalid sensor")

ser = serial.Serial(options.device, 9600, timeout=1)

ser.write(SENSOR_QUERY_CMD[options.sensor])
buf = ser.read(8)

temp = ord(buf[0]) | (ord(buf[1]) << 8)

degrees = temp / 16.0

if (options.use_celsius):
  if (options.output_mrtg):
    print "%.0f" % degrees
  else:
    print "%.4f degrees Celsius" % degrees
else:
  degrees = (9.0/5.0) * degrees + 32.0
  if (options.output_mrtg):
    print "%.0f" % degrees
  else:
    print "%.4f degrees Fahrenheit" % degrees

Update

The most up to date version of my script can be found in my Subversion repository.

[23:12] [tech] [permalink]

Thursday, 10 May 2007

It's a girl^Wboy!

My parents got back from a whirlwind trip to Canada this afternoon, and we thought that since their visit here was scheduled before we knew Sarah was pregnant, we thought one small way they could participate was to come along to an ultrasound screening that determined the baby's gender.

So we lashed out on one of those gimmicky 3D/4D ultrasounds, and didn't tell Mum and Dad what was going on until we got there, so as to make it a bit of a surprise for them. I think Dad thought we were going to see a baseball game, because when Mum asked what to wear, I told her it didn't matter, and that it was a spectator activity.

I called it as a boy before the sonographer made a call. She initially thought it was a girl, but revised it to be a boy as the scan progressed.

I'll update this post with some of the images later.

[22:54] [life] [permalink]