[实践OK]如何在Linux下得到硬盘及usb/usb3.0信息,以及lsusb命令的RPM包yum安装。

jackxiang 2010-6-23 20:53 | |
一)Linux下一个简单命令检测你的电脑上是否有USB 3.0接口:
lsusb -tv # 列出所有USB设备,通常情况下USB3.0接口是蓝色的,所以大家只要看到USB接口是蓝色的即可确认该接口是USB 3.0接口。
二)在Ubuntu中折腾了好几天终于解决了usb3.0不能开启:
https://blog.csdn.net/hs2188/article/details/85841825
--------------------------------------------------------------------------------
1.lsusb命令的RPM包yum安装:
rpm -qf /usr/bin/lsusb
usbutils-007-5.el7.x86_64

[root@localhost ~]# lsusb
lsusb     lsusb.py  
[root@localhost ~]# lsusb
Bus 001 Device 002: ID 8087:07e6 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 002 Device 003: ID 2c7c:0125  
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

2.如何得到硬盘的信息?

1,用fdisk -l 可以得到系统中已安装的硬盘列表及分区情况
[root@localhost lhd]# fdisk -l
Disk /dev/sda: 40.0 GB, 40060403712 bytes
255 heads, 63 sectors/track, 4870 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf0b1ebb0
Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1275    10241406    c  W95 FAT32 (LBA)
/dev/sda2            1276        4870    28876837+   f  W95 Ext'd (LBA)
/dev/sda5            1276        2550    10241406    b  W95 FAT32
/dev/sda6            2551        2575      200781   83  Linux
/dev/sda7            2576        4870    18434556   8e  Linux LVM
2,如何得到硬盘的品牌及相关信息
1,smartctl -i /dev/sda
说明: smartctl是用来控制和监视 smart disk的程序
-i 参数用来显示设备的相关信息

例:
[root@localhost lhd]# smartctl -i /dev/sda
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Device Model:     SAMSUNG MP0402H
Serial Number:    S03WJ10YC01628
Firmware Version: UC100-11
User Capacity:    40,060,403,712 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   7
ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 0
Local Time is:    Wed Jan 28 23:21:47 2009 CST
==> WARNING: May need -F samsung or -F samsung2 enabled; see manual for details.
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
2,有时使用smartctl不能得到我们预期的信息,例如:
[root@dev ~]# smartctl -i /dev/sda
smartctl version 5.36 [i686-redhat-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
Device: Dell     VIRTUAL DISK     Version: 1028
Device type: disk
Local Time is: Wed Jan 28 23:09:50 2009 CST
Device does not support SMART
这种情况如何处理:

[root@dev ~]# cat /proc/scsi/scsi                  
Attached devices:                                  
Host: scsi0 Channel: 00 Id: 00 Lun: 00              
Vendor: SEAGATE  Model: ST3146855SS      Rev: S527
Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: SEAGATE  Model: ST3146855SS      Rev: S527
Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi0 Channel: 01 Id: 00 Lun: 00
Vendor: Dell     Model: VIRTUAL DISK     Rev: 1028
Type:   Direct-Access                    ANSI SCSI revision: 05




3,如何得到usb设备的信息
lsusb
例如:
[root@localhost lhd]# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 046d:c00f Logitech, Inc. MouseMan Traveler/Mobile
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
查看详细信息,可以加 -v
lsusb -v
查看某一个设备:
[root@localhost lhd]# lsusb -s 003:002 -v                            
Bus 003 Device 002: ID 046d:c00f Logitech, Inc. MouseMan Traveler/Mobile
Device Descriptor:                                                      
bLength                18                                            
bDescriptorType         1                                            
bcdUSB               2.00                                            
bDeviceClass            0 (Defined at Interface level)                
bDeviceSubClass         0                                            
bDeviceProtocol         0                                            
bMaxPacketSize0         8                                            
idVendor           0x046d Logitech, Inc.                              
idProduct          0xc00f MouseMan Traveler/Mobile                    
bcdDevice           11.10                                            
iManufacturer           1 Logitech                                    
iProduct                2 USB-PS/2 Optical Mouse                      
iSerial                 0                                            
bNumConfigurations      1                                            
Configuration Descriptor:                                            
bLength                 9                                          
bDescriptorType         2                                          
wTotalLength           34                                          
bNumInterfaces          1                                          
bConfigurationValue     1                                          
iConfiguration          0                                          
bmAttributes         0xa0                                          
(Bus Powered)                                                    
Remote Wakeup
MaxPower               98mA
Interface Descriptor:
bLength                 9
bDescriptorType         4
bInterfaceNumber        0
bAlternateSetting       0
bNumEndpoints           1
bInterfaceClass         3 Human Interface Device
bInterfaceSubClass      1 Boot Interface Subclass
bInterfaceProtocol      2 Mouse
iInterface              0
HID Device Descriptor:
bLength                 9
bDescriptorType        33
bcdHID               1.10
bCountryCode            0 Not supported
bNumDescriptors         1
bDescriptorType        34 Report
wDescriptorLength      52
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength                 7
bDescriptorType         5
bEndpointAddress     0x81  EP 1 IN
bmAttributes            3
Transfer Type            Interrupt
Synch Type               None
Usage Type               Data
wMaxPacketSize     0x0004  1x 4 bytes
bInterval              10
Device Status:     0x0000
(Bus Powered)

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/3231/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2019-1-14 22:14
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]