如何在Linux下得到硬盘及usb信息

运维 系统运维
如何得到硬盘的信息?用fdisk -l 可以得到系统中已安装的硬盘列表及分区情况
如何得到硬盘的信息?
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)

【编辑推荐】

  1. 实验——LINUX常用网络测试命令
  2. 嵌入式设备上的Linux系统开发
  3. Linux 操作指导专题(华为内部)
责任编辑:张燕妮 来源: ChinaUnix博客  
相关推荐

2009-02-16 18:08:01

linux硬件信息cpu

2020-05-15 07:00:00

Linux硬盘信息

2015-10-22 13:07:29

USB设备权限Linux

2023-02-14 07:41:07

Linux 系统USB 驱动器

2020-06-08 17:00:52

LinuxUSBexFAT

2020-01-10 16:45:05

LinuxWindows 10USB

2018-08-13 09:57:15

LinuxFio硬盘性能

2017-02-08 21:20:24

LinuxUbuntu加密硬盘

2017-03-09 19:32:22

LinuxWindowsUSB

2020-11-22 07:20:15

LinuxEtcherUSB

2020-04-30 13:50:11

Linux网卡信息

2016-11-17 12:24:09

Linux坏道

2009-02-16 20:16:52

Linux网卡硬件查看

2021-02-22 18:30:37

LinuxUSB启动盘Windows

2011-04-06 10:53:36

MySQL

2022-11-07 15:29:06

UbuntuLinuxCPU

2009-02-19 09:53:19

Ubuntu系统监视

2009-05-26 12:20:34

Linux系统硬盘优化

2021-05-28 10:10:05

LinuxCPU机器学习

2011-09-07 13:23:56

Ubuntu
点赞
收藏

51CTO技术栈公众号