Friday, June 12, 2009

Pennsylvania Avenue

At the Nation Archives, looking south east toward the Capitol.

Scaffold in Chinatown

Looks like somebody is going to work on the Chinatown arch. I'll have to keep an eye on this.

Wednesday, June 10, 2009

Running Firefox Across an SSH Connection

I've always been annoyed by the Firefox "feature" of executing locally, even if initiated remotely. Consider this situation: You are running Firefox on your Linux workstation, and SSH into a server. On the server's command line, you launch Firefox. Rather than opening a new window which is X-tunneled back through SSH, it opens a new tab on the local Firefox. Argh!

Here's the solution:
[bungerd@lnxqa20 ~]$ MOZ_NO_REMOTE=1 firefox
[bungerd@lnxqa20 ~]$ firefox -no-remote
Either works, but the second seems more intuitive.

Monday, June 08, 2009

The Library of Congress


It was a nice day. I looked like a nice picture.

Sunday, June 07, 2009

Power Sources For DC-Baltimore Area

I got this in my power bill this week: a break down on the origins of the electrical power supplied by BGE (Baltimore Gas and Electric, which is owned by Constellation Energy.) The good news is very little oil. I already knew a significant portion was nuclear.

What is interesting is the Renewable energy column:

No solar. We've got a hundred miles of shoreline, and no wind power. Oh, and I love that wood fired generators are considered under the renewable energy category. The best part of wood power is that we consume forests, thus reducing our nature carbon filter, and discharge carbon at the same time. How very efficient.

This chart is a perfect example of one of the single biggest reasons expounded for NOT using solar of wind power: Politicians have claimed for decades that we should not use solar or wind, because we can't run cities like DC on solar and wind. Therefore, it is worthless technology.

I'm going to hand key the stats below to seed the search engines:
Coal 51.2%
Oil .3%
Natural Gas 6.4%
Nuclear 33.2%
System Mix 4.3%
Renewable Energy
* Captured Methane Gas .3%
* Geothermal 0%
* Hydroelectric 2.8%
* Solar 0%
* Solid Waste .1%
* Wind 0%
* Wood or Biomass 1.5%

Monday, June 01, 2009

Unraiding a Mirrored LVM Physical Volume

Here's the problem I've got: I have a mirrored RAID-1 that acts as the physical layer for an LVM volume group. One of the disk elements in the RAID mirror needs to be permanently removed. We could simply fail that element and be happy, but the question is whether I can convert the LVM to a partition without effecting the logical volume.

Be fore warned: we'll need to boot to get this to work.

Initial config:
[root@gfs1 ~]# ls -l /mnt
total 16
-rw-r--r-- 1 root root 0 2009-06-01 11:32 hello-there
[root@gfs1 ~]# pvscan
PV /dev/sda2   VG VolGroup00   lvm2 [4.88 GB / 2.59 GB free]
PV /dev/md0    VG changeme     lvm2 [4.99 GB / 3.99 GB free]
Total: 2 [9.87 GB] / in use: 2 [9.87 GB] / in no VG: 0 [0 ]
We want to change /dev/md0 to /dev/sdb1 without killing the hello-there file.

First, we remove the disk we want to keep from the array. We're doing this because the array is going to be destroyed.
[root@gfs1 ~]# umount /mnt
[root@gfs1 ~]# mdadm /dev/md0 -f /dev/sdb1
mdadm: set /dev/sdb1 faulty in /dev/md0
[root@gfs1 ~]# mdadm /dev/md0 -r /dev/sdb1
mdadm: hot removed /dev/sdb1
To prevent the RAID from restarting at boot time, we need to change the partition type from FD to 8E. Use fdisk, per SOP, or...
[root@gfs1 ~]# echo -e "t\n 8e\n p\n w\n" | fdisk /dev/sdb

Let's we nuke the raid. To accomplish this we are going to change the partition type from FD to 83.
[root@gfs1 ~]# echo -e "t\n 83\n p\n w\n" | fdisk /dev/sdb
[root@gfs1 ~]# echo "y" | pvremove /dev/md0 -ff
Notice we are setting this to a standard partition rather (83) rather than LVM (8e). This is because we do not want the kernel initializing the partition in the next step. Now, we do our first reboot.

During the boot sequence, neither disk will be recognized as a RAID element. The disk we want to keep will be a physical volume, because we tagged it as 8E. The disk we want to loose will appear to be an unformatted partition.

When the boot is complete, log back in, and check the LVM status:
[root@gfs1 ~]# pvscan
One of two things happened: You got lucky and your volume is displayed-- jump to the last step. Nine out of ten times, you have to reinitialize the volume with the correct UUID. You did record the UUID before you started... didn't you?

Oops.

No worries. Try this: (remember your UUID will be different.)
[root@gfs1 ~]# vgcfgrestore changeme
Couldn't find device with uuid '7ZXhzB-Bsm0-w9be-cu57-EPDx-xk4Q-f9vHdv'.
Couldn't find all physical volumes for volume group changeme.
Restore failed.
[root@gfs1 ~]# pvcreate --uuid '7ZXhzB-Bsm0-w9be-cu57-EPDx-xk4Q-f9vHdv' /dev/sdb1
Software RAID md superblock detected on /dev/sdb1. Wipe it? [y/n] y
Wiping software RAID md superblock on /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[root@gfs1 ~]# vgcfgrestore changeme
Restored volume group changeme
[root@gfs1 ~]# pvscan
PV /dev/sdb1 VG changeme lvm2 [4.99 GB / 4.89 GB free]
PV /dev/sda2 VG VolGroup00 lvm2 [4.88 GB / 2.59 GB free]
Total: 2 [9.87 GB] / in use: 2 [9.87 GB] / in no VG: 0 [0 ]
[root@gfs1 ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "changeme" using metadata type lvm2
Found volume group "VolGroup00" using metadata type lvm2
[root@gfs1 ~]# lvscan
inactive '/dev/changeme/keepme' [100.00 MB] inherit
ACTIVE    '/dev/VolGroup00/LogVol00' [2.00 GB] inherit
ACTIVE    '/dev/VolGroup00/LogVol01' [288.00 MB] inherit
[root@gfs1 ~]# lvchange -ay /dev/changeme/keepme
Mount the logical volume, and your done.

Thursday, May 14, 2009

The On-Call Blackberry

I got wrangled into having to use a Blackberry as part of an on call support gig. I'd never used a Blackberry before, always having carried Palm devices. This particular one is a RIM BlackBerry 8830.

...and it sucks!

The interface is absolutely horrible. It's like using an original Mac with a trackball-- today, not twenty years ago when the original Mac and trackball were breakthrough technology. Why doesn't it have a touch screen? How 1990's.

Even the apps are cluncky. How is it that people think these things are useful, helpful, cool, or intuitive? Palm is five years ahead of this piece of crap, and they are two years behind the iPhone. Even the MS Windows Mobile (WCE) systems are better than this. And to think that RIM has been the business package of choice.

I just don't get it.

Tuesday, April 28, 2009

Atomic Veterans

A friend at work mentioned that his father had "claimed" to have take part in atomic bomb tests in the 1950's , where unprotected soldiers were exposed to radiation. He wasn't sure he believed the story. I found this video on YouTube of the mission: Operation Buster-Jangle.

Yep, it was true. Not real smart, but true.

(Unfortunately, They won't let this one be embedded.)

Thursday, April 23, 2009

Cloud Storage Connect

This script will allow cluster nodes to connect to each other's ISCSI shares to create a cloud storage platform. I assume a high level of experience going into this. Maybe a howto should follow.

Carve out free space as a partition on each system. Define the partition as a Physical Volume in the Volume Group cloud. Share the partition via ISCSI (tgtd service), and start the service on all nodes. Execute the following on each node:
#!/bin/sh
#
# join nodes of a GFS cluster via iSCSI
#

if [ "$1" == "join" ]; then
  ACT="login"
elif [ "$1" == "leave" ]; then
  ACT="logout"
else
  echo "Usage: iscsi-cloud join|leave"
  echo "GPL 2009, dougbunger"
  exit 99
fi

grep "clusternode.*name" /etc/cluster/cluster.conf > /tmp/iscsi-nodes
sed -i "s/nodeid=.[0-9]*//" /tmp/iscsi-nodes
sed -i "s/votes=.[0-9]*//" /tmp/iscsi-nodes
sed -i "s/sed -i "s/[ \"=<>\t]//g" /tmp/iscsi-nodes

  ME=`hostname | cut -d\. -f1`
  for J in `grep -v $ME /tmp/iscsi-nodes`; do echo "$ACT node $J:"
    # discover
    L=`iscsiadm -m discovery -t sendtargets -p $J 2> /dev/null`
    T=`echo $L | cut -d\ -f2`
    echo "...$T"
    if [ "$T" != "" ]; then
      P=`echo $L | cut -d, -f1`
      echo "...$P"
      # bind
      iscsiadm -m node -T $T -p $P --$ACT
    fi
  done
vgscan
lvscan

exit
Restart the clvmd and lvm2-monitor service on all nodes. From any node, execute:
vgdisplay cloud
This will show the total space available across the cloud. Turns our system-config-lvm is cloud aware, and will keep all nodes in sync when creating or adjusting LVs.

Friday, April 10, 2009

Physical Layer Monitor

Here's a little script I whipped up to solve an argument as to whether the server was going to sleep or no packets were being routed into the box. The echo line could be tee'd for historical reference:
#/bin/sh
TRUE=1

while [ $TRUE = 1 ]; do
  killall tcpdump 2> /dev/null
  mv /dev/shm/netwatch.txt /dev/shm/netwatch-b.txt
    tcpdump > /dev/shm/netwatch.txt 2> /dev/null &
    IP=`grep -c " IP " /dev/shm/netwatch-b.txt`
    ARP=`grep -c " arp " /dev/shm/netwatch-b.txt`
    echo "`date +%T` packets=$IP arps=$ARP"
  sleep 10
done