Re: Storage device enumeration script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26 May 2011 04:21, Phil Turmel <philip@xxxxxxxxxx> wrote:
> On 05/25/2011 11:10 PM, Mathias BurÃn wrote:
>> On 26 May 2011 04:03, Phil Turmel <philip@xxxxxxxxxx> wrote:
>>> 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.
>>>
>>> Phil
>>>
>>
>> Awesome, 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,
>
> Phil
>

Aha, Archlinux defaults to python3. If I run the script with python2
it works. :)

~/bin $ sudo python2 lsdrv
PCI [ahci] 00:0b.0 SATA controller: nVidia Corporation MCP79 AHCI
Controller (rev b1)
 ââscsi 0:0:0:0 ATA Corsair CSSD-F60 {10326505580009990027}
 â  ââsda: Partitioned (dos) 55.90g
 â     ââsda1: (ext4) 100.00m 'ssd_boot' {ae879f86-73a4-451f-bb6b-e778ad1b57d6}
 â     â  ââMounted as /dev/sda1 @ /boot
 â     ââsda2: (swap) 2.00g 'ssd_swap' {a28e32fa-628c-419a-9693-ca88166d230f}
 â     ââsda3: (ext4) 53.80g 'ssd_root' {6e812ed7-01c4-4a76-ae31-7b3d36d847f5}
 â        ââMounted as /dev/disk/by-label/ssd_root @ /
 ââscsi 1:0:0:0 ATA WDC WD20EARS-00M {WD-WCAZA1022443}
 â  ââsdb: Partitioned (dos) 1.82t
 â     ââsdb1: MD raid6 (1/7) 1.82t md0 clean in_sync 'ion:0'
{e6595c64-b3ae-90b3-f011-33ac3f402d20}
 â        ââmd0: PV LVM2_member 9.08t/9.08t VG lvstorage 9.08t
{YLEUKB-klxF-X3gF-6dG3-DL4R-xebv-6gKQc2}
 â            ââVolume Group lvstorage (md0) 0 free {
Xd0HTM-azdN-v9kJ-C7vD-COcU-Cnn8-6AJ6hI}
 â              ââdm-0: (ext4) 9.08t 'storage'
{0ca82f13-680f-4b0d-a5d0-08c246a838e5}
 â                 ââMounted as /dev/mapper/lvstorage-storage @ /raid6volume
 ââscsi 2:0:0:0 ATA WDC WD20EARS-00M {WD-WMAZ20152590}
 â  ââsdc: Partitioned (dos) 1.82t
 â     ââsdc1: MD raid6 (3/7) 1.82t md0 clean in_sync 'ion:0'
{e6595c64-b3ae-90b3-f011-33ac3f402d20}
 ââscsi 3:0:0:0 ATA WDC WD20EARS-00M {WD-WMAZ20188479}
 â  ââsdd: Partitioned (dos) 1.82t
 â     ââsdd1: MD raid6 (2/7) 1.82t md0 clean in_sync 'ion:0'
{e6595c64-b3ae-90b3-f011-33ac3f402d20}
 ââscsi 4:x:x:x [Empty]
 ââscsi 5:x:x:x [Empty]
PCI [sata_mv] 05:00.0 SCSI storage controller: HighPoint Technologies,
Inc. RocketRAID 230x 4 Port SATA-II Controller (rev 02)
 ââscsi 6:0:0:0 ATA WDC WD20EARS-00M {WD-WCAZA3609190}
 â  ââsde: Partitioned (dos) 1.82t
 â     ââsde1: MD raid6 (6/7) 1.82t md0 clean in_sync 'ion:0'
{e6595c64-b3ae-90b3-f011-33ac3f402d20}
 ââscsi 7:0:0:0 ATA SAMSUNG HD204UI {S2HGJ1RZ800964}
 â  ââsdf: Partitioned (dos) 1.82t
 â     ââsdf1: MD raid6 (4/7) 1.82t md0 clean in_sync 'ion:0'
{e6595c64-b3ae-90b3-f011-33ac3f402d20}
 ââscsi 8:0:0:0 ATA WDC WD20EARS-00M {WD-WCAZA1000331}
 â  ââsdg: Partitioned (dos) 1.82t
 â     ââsdg1: MD raid6 (0/7) 1.82t md0 clean in_sync 'ion:0'
{e6595c64-b3ae-90b3-f011-33ac3f402d20}
 ââscsi 9:0:0:0 ATA SAMSUNG HD204UI {S2HGJ1RZ800850}
    ââsdh: Partitioned (dos) 1.82t
       ââsdh1: MD raid6 (5/7) 1.82t md0 clean in_sync 'ion:0'
{e6595c64-b3ae-90b3-f011-33ac3f402d20}


Sweet.

/M
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux