iostat -En输出格式

由于设备名称太长,使用'iostat -En'命令时,在解压Solaris 8 SPARC上的设备名称时出现问题。

例如

iostat -en output ---- errors --- s/wh/w trn tot 0 1 0 1 c6t50060E8005BDEC37d124 iostat –En ouput c6t50060E8005BDESoft Errors: 0 Hard Errors: 1 Transport Errors: 0 Vendor: HP Product: OPEN-V -SUN Revision: 6005 Serial No: 50 0BDEC01D2 Size: 36.20GB <36203397120 bytes> Media Error: 0 Device Not Ready: 0 No Device: 1 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 

当我使用iostat -En ,您可以看到c6t50060E8005BDEC37d124已成为c6t50060E8005BDESoft

我如何格式化它,如下所示:

 c6t50060E8005BDEC37d124 Soft Errors: 0 Hard Errors: 1 Transport Errors: 0 Vendor: HP Product: OPEN-V -SUN Revision: 6005 Serial No: 50 0BDEC01D2 Size: 36.20GB <36203397120 bytes> Media Error: 0 Device Not Ready: 0 No Device: 1 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 

我想用-E选项来检查'Product'的值,请不要使用-en

要获得可parsing的Productstring,可以使用kstat -c device_error 。 要将结果与c*t*d*值进行匹配,请在/etc/path_to_inst获取其节点名称,并查看/dev/dsk目录中的链接。

例如:

 # kstat -c device_error ... module: cmdkerror instance: 2 name: cmdk2,error class: device_error crtime 51.900857015 Device Not Ready 0 Hard Errors 0 Illegal Request 0 Media Error 0 Model Maxtor 6Y160M0 No Device 0 Recoverable 0 Revision Serial No Y41Y9W9E Size 163928604672 snaptime 68987.182338653 Soft Errors 0 Transport Errors 0 ... $ grep '2 "cmdk"' /etc/path_to_inst "/pci@0,0/pci-ide@12/ide@0/cmdk@0,0" 2 "cmdk" $ ls -l /dev/dsk | grep '/pci@0,0/pci-ide@12/ide@0/cmdk@0,0' | head -1 lrwxrwxrwx 1 root root 49 Sep 20 2010 c7d0p0 -> ../../devices/pci@0,0/pci-ide@12/ide@0/cmdk@0,0:q