Re: Storage device enumeration script
From: CoolCold <hidden>
Date: 2011-05-26 08:24:41
On Thu, May 26, 2011 at 7:21 AM, Phil Turmel [off-list ref] wrote:
On 05/25/2011 11:10 PM, Mathias Burén wrote:quoted
On 26 May 2011 04:03, Phil Turmel [off-list ref] wrote:quoted
Hi All, Last November, I shared a shell script that helped me keep track of the specific hot-swap drives I had in the various slots of my servers. Although encouraged by Roman and John, I declined to make a project out of it. I've since kicked it around some more, and thought a bit about supporting more than just the SCSI subsystem. The latest and greatest is still built around some standard executables: blkid, lspci, lsusb, sginfo, and smartctl. The original was similar to "lsscsi", but with controller details and device serial numbers. New features: Supports non-SCSI storage devices Describes layered block devices MD raid LVM generic device mapper loop (partial) Shows UUIDs Shows mountpoints Avoids repeating subtrees when enumerating raid devices I struggled with the last item, until I gave up on bash. I needed to pass data to subroutines by reference, and bash is sorely lacking in that area. The new script is in python. I'm releasing this one under the GPL version 2. Please give it a whirl. PhilAwesome, however: $ ./lsdrv.py File "./lsdrv.py", line 301 print "%s └─Volume Group %s (%s) %s free {%s}" % (indent, vg.name, ','.join([dev.name for dev in vg.PVs]), vg.free, vg.uuid) ^ SyntaxError: invalid syntax Maybe it's a copy-paste thing from my mail that does it. Could you put it somewhere, like a pastebin?Yeah, should have thought of that first. http://www.turmel.org/other/lsdrv HTH,
Works in Debian Squeeze, but requires packages pciutils and sg3-utils
to be installed.
On Debian Lenny produces error:
root@gamma2:/tmp# python lsdrv
Traceback (most recent call last):
File "lsdrv", line 17, in <module>
import os, io, re
ImportError: No module named io
Phil -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
-- Best regards, [COOLCOLD-RIPN] -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html