Is my RAID working? HP / Compaq SmartArray RAID on Linux

One of our servers is an HP / Compaq 2U machine (DL380 ?) with 6 hard drives and the SmartArray hardware RAID controller. This generally works quite well, but we don’t use one of the handful of Linux distributions that HP supports… so from their site we find a great lack of information on how to administrate or monitor the RAID. It seems silly to me, in the Linux world, to offer such narrow support. Even if only a handful of distributions are fully supported, manufacturers ought to at least offer a page of tips and links for using their hardware with other distributions, offer non-distro-specific tool downloads, human-readable dependency lists, etc.

A while back I got the HP tools to install using “alien”, but these tools seemed overly complex for the simple, ongoing task of monitoring the health of the RAID arrays.

Today I found a simple answer: ArrayProbe, a free / open source tool from:

http://www.strocamp.net/opensource/

for monitoring, among others, SmartArray (CCISS) controllers.

Installation on this Debian system was a not as easy as it could have been. First, the dev tools:

sudo apt-get install gcc libc6-dev

Then I found that it requires the kernel sources (not just headers), in /usr/src/linux, which is not where they landed by default. With a minor “ln-s” workaround, the tool complies and runs fine:

root@servername:~# arrayprobe

OK Arrayprobe
All controllers ok

More details are available with command line options. The simple, one-line output is well suited to automated monitoring and notification – far more useful in many-server environment than a whizbang GUI tool.
Also, a great resource for finding Linux tools for hardware RAID administration and monitor is at http://developer.skolelinux.no/info/prosjektet/delprosjekt/hw-raid-info.html.

Update June 2007: Steve Cameron, maintainer of the CCISS Linux drivers, wrote to point out that the CCISS project now includes (through considerable effort) a cciss_vol_status tool which serves a similar purpose. cciss_vol_status emits somewhat more detailed status data, and might also make it “in the box” in Linux distros eventually, with the core CCISS. I’m unable to try it out myself – we’ve replaced that DL380 with commodity hardware and Linux software RAID.

“Looping” an audio file with Sox, Lame and mkfifo

Today I needed a very long (3 hour) MP3 audio file to use for an experiment; a test file with some music on it. My first thought was to start a MP3 audio recorder, turn on the radio, and leave for 3 hours.

But impatience is among the three great virtues of a programmer, so I turned to Google instead, seeking command line tools for audio manipulation. It turns out that sox and lame will do the job. I installed the tools – here is the Debian / Ubuntu invocation:

apt-get install sox lame

then grabbed an MP3 file of a piece of music (Peter T. Noonan, album “Cafe at Arles”, track 9 “Life’s Old Road”, if you are curious) and repeated it a few times:

sox music.mp3 foo.wav repeat 3

lame foo.wav longmusic.mp3

This worked well, the first time… but consumed a lot of disk space. To get to 3 hours I would need enough disk space for a 3 hour uncompressed WAV file. Unfortunately Sox does not support MP3 output, and I didn’t want to compress to a format it does support, then uncompress and recompress again. So I used a Unix/Linux FIFO pipe instead of a file, with Sox running in the background to fill the pipe with data for Lame:

mkfifo foo.mp3

sox music.mp3 foo.wav repeat 10 &

lame foo.wav longmusic.mp3

a little while later, longmusic.mp3 is a very long MP3 file… but not long enough, because sox fails when the “virtual” WAV file it is writing reaches 2 Gb in size, just as it fails with a real WAV file at that size. That was about 1 hour and 41 minutes – not long enough; so I ended up looking elsewhere:

The Ugly Hack

It turns out that Lame will tolerate an MP3 which consists of several appended MP3 files as its input. It complains but keeps processing when encountering the extra headers in the middle of such a file. So this solution with cat, a pipe, and Lame, worked:

cat 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 1.mp3 | lame – longmusic.mp3

A little while later, I had a 3 hour long, valid MP3 file.

Make a DVD with ffmpeg

For a project we have going at Oasis Digital, we have explored various libraries for creating video DVDs from computer-generated content until program/script control. There are quite a few ways to do this; one that is appealing for a command-line junkie is the combination of ffmpeg, dvdauthor, and mkisofs. It took considerable research to figure out what commands to string together for a simple scenario:

  • you have some video in AVI format (for example, an MJPEG AVI from a DV video camera)
  • you have some background music in mp3 format
  • you want a simple one-title one-chapter DVD with that video and audio

There are plenty of sites with long and complex sets of commands to accomplish these things. But for this simplest case, the essential commands are:

ffmpeg -y -i video.avi -i audio.mp3 -target ntsc-dvd -aspect 4:3 dvd.mpg

mkdir DVD

dvdauthor -x file.xml # there is a way to avoid the file by putting a few more options here

mkisofs -dvd-video -o dvd.iso DVD

Of course, there is considerable other work involved in wiring up a full solution, but that is more project specific. I hope these example commands shorten the research time for the next fellow who needs to do this core processing.

Ruby OpenGL, Kororaa Xgl

Last night at StlRuby.org the question came up of how to contruct GUIs with Ruby. I mentioned that I think there is a lot to be gained by using the high performance graphics hardware APIs, which are mostly used for games, in business applications. This of course is not all that remarkable, since Java Swing has used DirectX for drawing for the last several years, and Windows “Vista” will use it for most of Windows itself. I’ll discuss this idea more in a later post; I’m investigating it here for a couple of Oasis Digital projects. On my list of tools to experiment with is Ruby + OpenGL; there is a RubyGarden page about it and another page here, unfortunately in Japanese. I found a ruby-talk post which indicates that it works quite well.

John McClenning pointed out Kororaa Xgl, a project which modified an X server to draw with the OpenGL API; there is a LiveCD of the Kororaa Linux distribution for trying this out. I’m downloading it now the torrent. Novell is also a sponsor of this effort.

(A plug: uTorrent is the best BitTorrent client I’ve seen so far: it is small, clean, featureful, usable, robust, ad-free, and free.)