Blog O' Matty


Updating Emulex boot code on Solaris hosts

This article was posted by Matty on 2009-05-03 12:07:00 -0400 -0400

I previously discussed updating Emulex adapter firmware, but didn’t touch on updating the adapter’s boot code. The boot code allows you to boot from a SAN device, and is a separate upgrade from the standard firmware. To upgrade the boot code, you can run the emlxadm download_boot command with the name of the boot code image:

emlxadm> **download_boot /export/home/matty/TB202A2.PRG**

Image Components: REL type size=50232
DWC file: BOOT: version=03812092, 2.02a2

Current: Boot: none
New: Boot: 2.02a2 50232 (0xc438) bytes

Are you sure you want to download this image? (y or n): y

Downloading...

Result: Operation successful.
Done.

emlxadm> **get_boot_rev**

<p>
Boot revision: LP10000DC 2.02a2

This post is a reference for myself, and I take ZERO responsibility for botched firmware updates. As with all information on this blog, use this information at your own risk (no warranties of any sort are provided).

Using tmpwatch to automate temporary file cleanup on Linux hosts

This article was posted by Matty on 2009-05-01 11:01:00 -0400 -0400

I have seen a number of applications that use temporary working directories, and over time files get orphaned in these directories. Typically when this happens I need to fire up find to locate old files, and then use the exec flag to remove them once I know they are no longer needed. In some cases I don’t need to check whether these files need to be kept, and I can just blast old cruft that was created. For these situations, I have come to rely on the tmpwatch utility that ships with CentOS Linux. Tmpwatch can be configured to remove files older than X hours, and has a daily cron job that kicks off from /etc/cron.daily to purge a select few files in /tmp and /var/:

$ cat /etc/cron.daily/tmpwatch

flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 240 /tmp

/usr/sbin/tmpwatch "$flags" 720 /var/tmp

for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d "$d" ]; then
        /usr/sbin/tmpwatch "$flags" -f 720 "$d"
    fi
done

To clean up temporary files in the directory named /opt/APP/tmp that are over 90-hours old, a tmpwatch entry similar to the following can be created:

$ /usr/sbin/tmpwatch -umc 90 /opt/APP/tmp

If you are curious what tmpwatch will do, you can run it in test mode by adding the “-t” (operate in test mode) and “-v” (verbose output) options to the command line. This is a useful utility, and has a bunch of cool options to control what is and isn’t removed (I need to test out the “-s” (check for open files before deleting them) option in the future).

Viewing hard drive temperatures on Linux hosts

This article was posted by Matty on 2009-04-30 10:37:00 -0400 -0400

While reviewing the sensor data provided by lm-sensors, I started to wonder if there was an easy way to list hard drive temperatures. The smartctl utility can show this information per drive, but I wanted something that would dump temperatures for all drives in my systems. After a bit of searching, I came across the hddtemp utility:

$ hddtemp /dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sdb /dev/sdb1 /dev/sdb9 /dev/sdc /dev/sdc1 /dev/sdc9 /dev/sdd /dev/sdd1 /dev/sde

/dev/sda: HITACHI HDS7225SBSUN250G0 36N4US6Y J ?: 35°C
/dev/sdb: WDC WD7500AACS-00D6B1: 37°C
/dev/sdc: WDC WD7500AACS-00D6B1: 36°C
/dev/sdd: WDC WD7500AACS-00D6B1: 38°C

I haven’t read through the hddtemp source code to see if it is using ioctl()‘s or /sys to get this information, but I’m stoked that this information is so easy to get to (tying this into Nagios would be kinda nifty). Viva CentOS Linux!

Upgrading Brocade firmware

This article was posted by Matty on 2009-04-29 12:01:00 -0400 -0400

I recently purchased a Brocade 3200 for my lab, and wanted to upgrade the switch to the latest stable version of firmware. Brocade comes with the “firmwaredownload” command, which can be used to retrieve and load a firmware image from a remote FTP or RSH server:

Switch:admin> **firmwaredownload**

Server Name or IP Address [host]: 192.168.1.5
User Name [user]: matty
File Name [/usr/switch/firmware]: /firmware/v3.2.1c
Protocol (RSHD or FTP) [rshd]: ftp
Password:
110336+6408+131212, csum ad9a
................................................
writing flash 0 ................................................
writing flash 1 ................................................
download complete

Once the firmware image has been downloaded and applied, you can verify the version with the “version” command:

Switch:admin> **version**

Kernel: 5.4
Fabric OS: v3.2.1c
Made on: Wed Jun 20 13:21:52 PDT 2007
Flash: Wed Jun 20 13:26:05 PDT 2007
BootProm: Tue Oct 30 10:24:38 PST 2001

I really dig Brocade switches, and am amazed that a switch this old performs so well!

Viewing SCSI device information on Linux hosts

This article was posted by Matty on 2009-04-28 09:37:00 -0400 -0400

I chatted about the new server I built a few posts back, and wanted a quick way to view the SATA devices in the system. While the dmesg and /proc data can be used to locate this information, I always find the lsscsi utility to be a bit more useful:

$ lsscsi

[0:0:0:0] disk ATA HITACHI HDS7225S V44O /dev/sda
[1:0:0:0] cd/dvd TSSTcorp CDDVDW SH-S223Q SB03 /dev/scd0

In addition to displaying the device ID, it also provides the vendor string and the device that corresponds to each device ID. Useful utility, and it’s one yum install away.