Converting to RAID 1

I was at Fry’s recently and saw a good deal on a 500 GB hard drive. I decided to get it to expand my home server from a single 500 GB drive to two drives in RAID 1. With Linux, it is possible to do the conversion without any downtime (but lots of time spent copying files). The secret is to create the RAID 1 volume in a degraded state with the new drive, copy the files to the RAID 1 voume, and then add the old drive to the volume. With LVM2, the extents can be moved with pvmove.

  1. Partition the new drive

    fdisk /dev/sdb

  2. Create the RAID 1 volume

    mdadm –create /dev/md0 –level=1 –raid-devices=2 missing /dev/sdb1

  3. Create the Physical Volume

    pvcreate /dev/md0

  4. Add PV to Volume Group

    vgextend vg0 /dev/md0

  5. Move all the extents to new volume (takes a long time)

    pvmove /dev/sda1 /dev/md0

  6. Remove old disk from volume group

    vgreduce vg0 /dev/sda1

  7. Add the old disk to RAID volume (takes a long time)

    mdadm /dev/md0 –add /dev/sda1

Digital SLR

I recently got a digital SLR. I decided to pay more for the most recent consumer model over the earlier generation. Lots of places recommended the Nikon D40. But most sites recommended Canon system over Nikon in general. The XSi also had some features like live view, bigger LCD, and better kit lens that I liked.

I also got two lenses in addition to the included 18-55mm IS kit lens. I got the Canon EF-S 55-250mm IS telephoto zoom that matches the kit lens. I also got the Canon EF 50mm f/1.8 which was supposed to be cheap, fast prime.

I got some pictures with it on my recent trip that I wouldn’t have been able to get with my old camera. The quick response allowed taking some series of photos of moving subjects. I got some great photos with the telephoto. The image stabilization was very handy when zoomed all the way out. I got a couple of pictures with the prime lens in low light that probably wouldn’t have turned out otherwise. I took a few workable pictures inside the aquarium without a flash. The flash fill improved a couple of pictures of people taken in sunlight.

Mini-ITX Home Server

A few months ago, I got a new home server. I wanted to replace the old desktop with something quiet and low-power that could be left on all day. This led toward an mini-ITX motherboard. A fanless processor was better since I didn’t need the performance for video or anything heavy. I also wanted something upgradable to four SATA hard drives and with Gigabit Ethernet. All of it needed to cost less than $500 without drives.

The only case mini-ITX case with space for four hard drives I found was the Chenbro ES34069. It was a little expensive but turned out to be nicely designed and well made. The hard drives go in caddies which plug into a SATA backplane. It also has space for a 2.5″ hard drive, thin CD drive, and memory card reader. I decided to get a CompactFlash card in an IDE adapter for the system drive. I skipped the CD drive and reader.

For the motherboard, I wanted to balance having 4 SATA ports, Gigabit Ethernet, and fanless processor. The VIA EPIA SN10000EG would have worked well with 4 SATA ports and fanless processor but was too expensive. I chose to get the Jetway J7F4K1G2E which has a fanless VIA C7 processor, Gigabit Ethernet, and only 2 SATA ports. When I made the decision, the Intel Atom motherboard, the D945GCLF, had just been released. Unfortunately, it did not have Gigabit and the chipset uses more power than the processor. There are now more Atom motherboards with Gigabit and even 4 SATA ports that would work better.

The first problem with the install was forgetting the adapter cable from 40-pin IDE on motherboard to 44-pin notebook IDE connector on the drive. The second problem was the lack of mounting holes in the right place for the non-standard position of the 2.5″ drive. I was able to wedge it in place. The CompactFlash card was nice because I could put in the memory card reader on my desktop to write the root filesystem. When I do decide to go to 4 drives, I will need get a special riser card to use a PCI SATA adapter. That will be a tight fit in an already tight case. The case has a place for everything put it requires putting together in the correct order to get it all to fit.

Flickr: Oregon Coast 2008

IMG_0446.JPG IMG_0362.JPG IMG_0450.JPG IMG_0418.JPG IMG_0397.JPG IMG_0384.JPG IMG_0370.JPG IMG_0342.JPG IMG_0329.JPG IMG_0314.JPG

My Poor Car

I got my car back from the shop on Tuesday. The saga started two weeks ago when I went to drive home. The clutch went straight down and didn’t pop back up. I had it towed to the Audi dealer service center, which is close to work, the next day. The problem turned out to be a leak in the slave cylinder. Then, they took the clutch apart to find and replace parts that had been damaged by the leak. Luckily, the whole thing was covered by the factory warranty which transfered to me when I bought it new.

They also gave me a loaner in the middle of last week. I was getting tired of walking to the grocery store. And taking the bus and train to work. It was an Audi A4 Avant S-line, a much nicer car than my A3. I like my A3 more. It handles better and accelerates faster and is nice enough for me.

I had noticed that the clutch was feeling different. In fact, I forgot to ask them about it when I took it in for regular maintenance the week before it failed. I am little worried that it failed after only 34,000 miles. Hopefully, it won’t be in the shop any time soon. This was the third, and longest, time in a month. A month ago, I had the lower front bumper cover replaced after I scraped it on a crub and the side ripped out.

Maemo SDK on Fedora 9

I got the Maemo SDK installed on Fedora 9. The instructions are pretty complete.

First, Scratchbox needs the compat VDSO mode enabled. This is done by echo 0 > /proc/sys/vm/vdso_enabled. Also, Qemu requires mmap_min_addr set to 4096. These can be set permanently by adding the following lines to /etc/sysctl.conf.

# scratchbox support
vm.vdso_enabled = 0
vm.mmap_min_addr = 4096

On my desktop, which is x86_64, compat VDSO can only be set with the vdso32=0 kernel command-line option. Also, the scratchbox installer script checks for i386 architecture. It needs to faked out like this: setarch i386 ./maemo-scratchbox-install_4.1.sh.

VIA padlock support in OpenSSL

The VIA C7 processor also has padlock encryption acceleration support. Linux support was added a while ago.

First, the automatically load the padlock module, add the /etc/sysconfig/modules/via-padlock.modules file.

#!/bin/sh
for i in padlock; do
    modprobe $i >/dev/null 2>&1
done

Second, to use it for internal kernel encryption, add to /etc/modprobe.conf.

alias aes padlock

Third, OpenSSL can be configured to use padlock. To see if your OpenSSL was compiled with padlock support, do openssl engine padlock. You can see the speed difference by comparing openssl speed -evp aes-128-cbc to openssl speed -evp aes-128-cbc -engine padlock. To use padlock engine by default, add the following lines to the top of `/etc/pki/tls/openssl.cnf.

#enable padlock engine by default:
openssl_conf = openssl_def

[openssl_def]
engines = openssl_engines

[openssl_engines]
padlock = padlock_engine

[padlock_engine]
default_algorithms = ALL

Unfortunately, the version of openssh in Centos 5 does not use the padlock engine. Engine support was added to openssh in 4.9p1 (bug 1437). It looks like there is a bug with engine support which is fixed in OpenSSL 0.9.7h. It looks like Ubuntu Hardy has patched its packages.

VIA RNG on Centos

The J7F4 mini-ITX motherboard that I got for my home server has a VIA C7 processor. One of the feature of the processor is the PadLock Security Engine with hardware RNG. This is especially useful on a server since they are limited in entropy sources. Linux kernel has support for the VIA hardware RNG in the via_rng module.

Next, install the rng-utils package with the rngd daemon. It reads entropy from the hardware RNG, /dev/hwrng, and feeds it to the kernel entropy pool for /dev/random.

Unfortunately, the package is missing an init.d script to start the service (see redhat bug 215371. The /etc/rc.d/rc.sysinit actually has a commented-out line to start rngd. Download the script from the bug and put it in /etc/init.d/rngd. Add the service, chkconfig --add rngd, and start it, service rngd start.

Oregon Brewers Festival

After OSCON ended, I went to the Oregon Brewers Festival on Friday afternoon. This is the first time I have gone after living in Portland for five years and loving beer. I rode my bike downtown; they had guarded bike parking. The cost was $4 for the mug, $1 for tokens which give a taste (or 4 give a full glass). When I went, the tents were fairly crowded but there weren’t long lines for the beer or the restrooms.

First, I had a full glass of Flying Fish Bourbon Barrel Abbey Dubbel which is a delicious Belgian-style Dubbel. Then, I had tastes of Rogue Ales Imperial Porter, Boulder Beer Sweaty Betty Blonde, Green Flash West Coast IPA, and Laurelwood PNW Pils. I deliberately tried to get beers from non-locals breweries since I seen many of the local beers in bars or stores.

OSCON: Friday

On Friday, I made it to the morning keynotes. None of them were really informative but were entertaining and funny.

I attended ZFS: Bringing Terabytes Under Control by Jay Edwards. He mainly talked about using ZFS on Solaris for large storage systems. The biggest advantage of ZFS is the nice management tools for creating pools and filesystems. RAIDZ, which is RAID5 with tracking of which blocks need to be rebuilt, sounded neat. The copy-on-write behavior which makes snapshots and clones easy sounded very useful. He mentioned some of the problems between the impedance mismatch between smart ZFS and smart hardware. ZFS assumes that the hardware is dumb and lies which causes performance problems with smart drive arrays.

Next, I went to Running Your Programming Language on Parrot by chromiat and Patrick Michaud. They talked about how to write parsers and compilers for Parrot using the Parrot Compiler Tools. The tools make it easy to write a Parrot compiler for a language by doing a parse grammar and AST grammar to transform the source into an AST; the tools can produce PIR from the AST. It sounded like the new tools are being used for more languages and should improve the progress in getting languages implemented on Parrot.