Friday, June 12, 2009

lsscsi and systool

The lspci andlsusb commands are familiar to me, but lsscsi was unfamiliar. Written by Doug Gilbert, it provides information about SCSI devices by scanning the sysfs pseudo file system. The author maintained a web page (now defunct) that provided useful information about lsscsi, including some detailed descriptions of the SCSI subsystem information available. Fortunately, a copy resides here. Here's a sample listing from my system That also shows the generic SCSI device names (note that command can be run as a regular user) :

The systool has been around for a while and has a Website. It's a utility developed for the sysfs virtual filesystem used since Linux kernel 2.5. The project's overall goal is to develop diagnostic tools for Linux and the site has several examples.

One use of systool is to reveal what option settings have been applied to kernel modules . For example, to see information about the libata module (note that it too can be run by a regular user):

Sadly, many of these options are not well documented, even in the source code. Even when some comments exist, they are cryptic and could use a decent reference. For example, the allow_tpm option is described with modinfo only to the extent that it can be enabled or disable. There is some discussion of it in the source code, but WTF is it? It appears to be an acronym for Trusted Platform Module, part of software developed by TCG (the Trusted Computing Group). A TPM is a microcontroller on a motherboard used to store keys, passwords and digital certificates, i.e. a hardware-based security device. Why do Linux users care? It seems that a bit in the ATA identify data was re-assigned to TCG and could cause a serious problem for the Linux libata driver since a TGC-enabled drive would trigger 32bit I/O on some systems. Alan Cox submitted a patch to "fix" this by dis-allowing this bit on TCG-enabled drives, causing the system to "opt out" of complying with TCG "security/DRM" features. It does alert the user that they may not have full use of the device. It also was necessary to implement this feature because manufacturers of Linux-run devices may legitimately choose to implement DRM in their devices. Some module options for libata are set from the kernel command line (see kernel-options.txt in the kernel source Documentation). There's also a libATA FAQ which includes info on "Intel combined mode" explaining why your drives are accessed at wrong/different speeds and how to fix that (try combined_mode=libata on the kernel command line).