Port multiplier support in opensolaris

I just saw the following opensolaris putback notice:

PSARC/2009/394 SATA Framework Port Multiplier Support
6422924 sata framework has to support port multipliers
6691950 ahci driver needs to support SIL3726/4726 SATA port multiplier

This is awesome news, and I’m hopeful this will allow me to use one of my external SATA enclosures with OpenSolaris. Time to live upgrade my systems!

Viewing PCI bus throughput on Solaris systems

The PCI and PCI express interconnect technologies have become the defacto standard for connecting peripherals to most motherboards. 64-bit 66 MHZ PCI interconnects run with speeds up to 528MB/s, and share the available bandwidth between devices on the PCI bus. PCI express x32 runs with speeds up to 8 GB/s, and provides dedicated “lanes” to connect each peripheral directly to the motherboards chipsets. This allows PCI express devices to utilize all of the available bandwidth, and maximizes throughput since PCI express devices do not need to compete with other devices on the bus. On systems that utilize gigabit Ethernet and 4 GB/s HBAs, it is possible to saturate a 33 or 66 MHZ PCI bus during peak loads. If you happen to be using a PCI interconnect and the Solaris Operating System, you can easily measure the current PCI bus utilization with the busstat(1m) command:

$ busstat -w pcis0,pic0=dvma_cycles,pic1=dvma_wd_xfr -w pcis1=pic0=dvma_cycles,pic1=dvma_wd_xfr 5

time dev    event0               pic0        event1               pic1
5    pcis0  dvma_cycles          482928      dvma_wd_xfr          115184
5    pcis1  dvma_cycles          20217638    dvma_wd_xfr          32815051
10   pcis0  dvma_cycles          482778      dvma_wd_xfr          115046
10   pcis1  dvma_cycles          20989675    dvma_wd_xfr          34068291
15   pcis0  dvma_cycles          482643      dvma_wd_xfr          115069
15   pcis1  dvma_cycles          20834960    dvma_wd_xfr          33817211

bustat’s “-w (instrument PIC to collect statistics) option will program the PCI interconnects PICs (programmable interrupt controller) to collect the statistic passed as an option. These statistics including the number of PIO mode reads and writes, bus throughput, stream transfers, interrupts, and the number of DMA and DVMA operations performed. These counters are documented in the Systems Performance and Tuning book, and can also be viewed by sifting through writing Solaris PCI device drivers for Sun SPARC platforms.

Ridding myself of cat hair and cat allergies

My CatI have had my cat T-bone for close to 13 years, and she has been with me through the many phases and places of my life. Always chipper and upbeat, her crazy antics are amusing to say the least.

But, as much as I love her, I seriously hate how much she sheds and the allergies that I have developed while owning a cat. Since I dig my cat and couldn’t bear to get rid of her, I have tried numerous things to reduce the allergens she created. These are the ones that I found the most successful:

1. I purchased two Honeywell 17005 hepa filters to filter dander, dust and other allergens out of the air. This definitely made the air I breathed cleaner, and after looking at the filter I knew this was making an impact (the filter went from black to grey after only 3 weeks of operation!!!).

2. I purchased an iRobot roomba and scheduled it to run every other day. I’m not much for vacuuming all the time, so having this little guy do the work every day or so made a HUGE difference in my allergies.

3. I replaced my stock air filters with high grade allergy reducing filters. They are a bit more expensive, but well worth the extra money.

I definitely noticed a drastic improvement in my allergies, and my overall health improved significantly. But even with the items listed above, I still noticed a fair amount of fur around my apartment. So…

One of my friends recently tipped me off to the furminator. If you’re not familiar with this thing, you should check it out. It is a pet brush that virtuality eliminates shedding. After a few weeks of use my only response is WOW! Not only does this thing remove mounds of hair from my cat, but I can already see a reduction in the amount of fur that is left on my furniture and rugs. I’m curious to see how this little gem helps with my quest to completely rid myself of cat allergies (or at least the causes), and will make sure to report back once I have a few months of sample data. :)

Backing up and restoring partition tables on Linux hosts

I recently had to adjust the partition layout on a couple of disk drives. This work occurred on devices with actual data (I made backups before starting), so I needed to be extra careful while performing my work. To ensure that I could recover the data if something went wrong with the partitioning, I made backups of each partition prior to beginning work. Assuming you are using a DOS (MBR) labeled disk, there are two ways to back up the partition table:

1. Use dd to archive sector 0 to a safe location

2. Archive the partition table to a safe location with parted or sfdisk

To backup a device using option 1, you can use a dd statement similar to the following:

$ dd if=/dev/sda of=/backups/sda.sector0 count=1

To restore the partion table using dd, you can can alter the dd source and destination like so:

$ dd if=/backups/sda.sector0 of=/dev/sda count=1

While this approach works well, I tend to prefer the second method. There are a couple of reasons for this:

1. If you botch the dd statement, you can overwrite actual data making recovery extremely difficult (thank goodness for tools like ext3grep!)

2. The MBR contains code as well as the partition table, so you can’t easily view the partion table if you run into issues

To use sfdisk to backup the partition table, you can run sfdisk with the “-d” (dump the partion table in a format that be easily consumed in the future) option and the device to extract the partion table from:

$ sfdisk -d /dev/sda > /backups/sda.ptbl

$ cat /backups/sda.ptbl

# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=       63, size=479987329, Id=83, bootable
/dev/sda2 : start=479987392, size=  8388608, Id=83
/dev/sda3 : start=        0, size=        0, Id= 0
/dev/sda4 : start=        0, size=        0, Id= 0

If for some reason you botch the partition table, you can feed the partion table as input to sfdisk:

$ sfdisk /dev/sda < /backups/sda.ptbl

The second approach has the added benefit that you can review the partition table with a pager while you are making changes, which is especially useful when you grow a LUN and need to use the new space. sfdisk and parted are extremely handy tools, but you should use them with extreme caution! One wrong move can nuke your data, and the author is not responsible for any damage that you may cause to your systems as a result of this post!

Using the Linux netconsole service to send console messages to remote hosts

Most Linux distributions ship with the netconsole service, which allows kernel printk() messages to be sent to a remote destination. This feature can be useful for debugging system hangs and panics, and is handy for archiving console messages to a central location. To configure netconsole, you will need to add the IP address of a remote syslog server to /etc/sysconfig/netconsole. Here is a sample entry:

# The IP address of the remote syslog server to send messages to

Once the IP is added to the configuration file, you can start the netconsole service:

$ service netconsole start

Initializing netconsole                                    [  OK  ]

$ chkconfig netconsole on

This will load the netconsole kernel module, and write the configuration that was used to the system logs:

Aug 5 13:25:57 disarm netconsole: : inserting netconsole module with arguments \ netconsole=6666@,514@
Aug 5 13:25:57 disarm kernel: netconsole: local port 6666
Aug 5 13:25:57 disarm kernel: netconsole: local IP
Aug 5 13:25:57 disarm kernel: netconsole: interface eth1
Aug 5 13:25:57 disarm kernel: netconsole: remote port 514
Aug 5 13:25:57 disarm kernel: netconsole: remote IP
Aug 5 13:25:57 disarm kernel: netconsole: remote ethernet address 00:24:8c:0b:eb:ab
Aug 5 13:25:57 disarm kernel: console [netcon0] enabled
Aug 5 13:25:57 disarm kernel: netconsole: network logging started

If the netconsole service starts up successfully, each console message should be routed to the remote syslog server. If you happen to encounter the following error when you try to start the netconsole service:

$ service netconsole start

Initializing netconsole FATAL: Error inserting netconsole \
(/lib/modules/  \
Unknown error 524

You will need to add the Ethernet interface to the “DEV” variable in the netconsole configuration file (the kernel doesn’t appear to allow bonded or bridged interfaces to work with netconsole, which is one of the drawbacks to using it). I dig netconsole, though it’s no substitute for a properly configured serial console.