硬件相关汇总

发布时间: 更新时间: 总字数:1244 阅读时间:3m 作者: IP上海 分享 网址

Linux 硬件操作命令汇总

硬件架构

  • 北桥(North Bridge、Host Bridge) 主要负责 CPU 和内存、显卡这些部件的数据传送
  • 南桥(South Bridge) 主要负责 I/O 设备、外部存储设备以及 BIOS 之间的通信

获取硬件信息

  • iostat
iostat -xm -o JSON /dev/sdb |grep disk_device
iostat -x 1 2 -o JSON /dev/sdb
  • dmidecode
$ dmidecode -t 1
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.

Handle 0x0100, DMI type 1, 27 bytes
System Information
	Manufacturer: Alibaba Cloud
	Product Name: Alibaba Cloud ECS
	Version: pc-i440fx-2.1
	Serial Number: 702ebfc5-005d-493f-9146-441f447a2529
	UUID: 702EBFC5-005D-493F-9146-441F447A2529
	Wake-up Type: Power Switch
	SKU Number: Not Specified
	Family: Not Specified
  • lshw
lshw ...
$ yum install -y lshw
$ lshw
a1.xiexianbin.cn
    description: Computer
    product: Alibaba Cloud ECS
    vendor: Alibaba Cloud
    version: pc-i440fx-2.1
    serial: 702ebfc5-005d-493f-9146-441f447a2529
    width: 64 bits
    capabilities: smbios-2.8 dmi-2.8 vsyscall32
    configuration: boot=normal uuid=C5BF2E70-5D00-3F49-9146-441F447A2529
  *-core
       description: Motherboard
       physical id: 0
     *-firmware
          description: BIOS
          vendor: SeaBIOS
          physical id: 0
          version: 3288b3c
          date: 04/01/2014
          size: 96KiB
     *-cpu
          description: CPU
          product: Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz
          vendor: Intel Corp.
          vendor_id: GenuineIntel
          physical id: 400
          bus info: cpu@0
          version: 6.79.1
          slot: CPU 0
          width: 64 bits
          capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp x86-64 constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt spec_ctrl intel_stibp
          configuration: cores=1 enabledcores=1 microcode=0 threads=2
     *-memory
          description: System Memory
          physical id: 1000
          size: 2GiB
          capacity: 2GiB
          capabilities: ecc
          configuration: errordetection=multi-bit-ecc
        *-bank
             description: DIMM RAM
             vendor: Alibaba Cloud
             physical id: 0
             slot: DIMM 0
             size: 2GiB
     *-pci
          description: Host bridge
          product: 440FX - 82441FX PMC [Natoma]
          vendor: Intel Corporation
          physical id: 100
          bus info: pci@0000:00:00.0
          version: 02
          width: 32 bits
          clock: 33MHz
        *-isa
             description: ISA bridge
             product: 82371SB PIIX3 ISA [Natoma/Triton II]
             vendor: Intel Corporation
             physical id: 1
             bus info: pci@0000:00:01.0
             version: 00
             width: 32 bits
             clock: 33MHz
             capabilities: isa
             configuration: latency=0
        *-ide
             description: IDE interface
             product: 82371SB PIIX3 IDE [Natoma/Triton II]
             vendor: Intel Corporation
             physical id: 1.1
             bus info: pci@0000:00:01.1
             version: 00
             width: 32 bits
             clock: 33MHz
             capabilities: ide isa_compat_mode bus_master
             configuration: driver=ata_piix latency=0
             resources: irq:0 ioport:1f0(size=8) ioport:3f6 ioport:170(size=8) ioport:376 ioport:c0c0(size=16)
        *-usb
             description: USB controller
             product: 82371SB PIIX3 USB [Natoma/Triton II]
             vendor: Intel Corporation
             physical id: 1.2
             bus info: pci@0000:00:01.2
             version: 01
             width: 32 bits
             clock: 33MHz
             capabilities: uhci bus_master
             configuration: driver=uhci_hcd latency=0
             resources: irq:11 ioport:c040(size=32)
           *-usbhost
                product: UHCI Host Controller
                vendor: Linux 3.10.0-862.14.4.el7.x86_64 uhci_hcd
                physical id: 1
                bus info: usb@1
                logical name: usb1
                version: 3.10
                capabilities: usb-1.10
                configuration: driver=hub slots=2 speed=12Mbit/s
              *-usb
                   description: Mouse
                   product: QEMU USB Tablet
                   vendor: QEMU
                   physical id: 1
                   bus info: usb@1:1
                   version: 0.00
                   serial: 42
                   capabilities: usb-2.00
                   configuration: driver=usbhid maxpower=100mA speed=12Mbit/s
        *-bridge
             description: Bridge
             product: 82371AB/EB/MB PIIX4 ACPI
             vendor: Intel Corporation
             physical id: 1.3
             bus info: pci@0000:00:01.3
             version: 03
             width: 32 bits
             clock: 33MHz
             capabilities: bridge
             configuration: driver=piix4_smbus latency=0
             resources: irq:9
        *-display
             description: VGA compatible controller
             product: GD 5446
             vendor: Cirrus Logic
             physical id: 2
             bus info: pci@0000:00:02.0
             version: 00
             width: 32 bits
             clock: 33MHz
             capabilities: vga_controller rom
             configuration: driver=cirrus latency=0
             resources: irq:0 memory:fc000000-fdffffff memory:febd0000-febd0fff memory:febc0000-febcffff
        *-network
             description: Ethernet controller
             product: Virtio network device
             vendor: Red Hat, Inc.
             physical id: 3
             bus info: pci@0000:00:03.0
             version: 00
             width: 32 bits
             clock: 33MHz
             capabilities: msix bus_master cap_list rom
             configuration: driver=virtio-pci latency=0
             resources: irq:10 ioport:c060(size=32) memory:febd1000-febd1fff memory:feb80000-febbffff
           *-virtio0
                description: Ethernet interface
                physical id: 0
                bus info: virtio@0
                logical name: eth0
                serial: 00:16:3e:08:ec:f1
                capabilities: ethernet physical
                configuration: broadcast=yes driver=virtio_net driverversion=1.0.0 ip=172.31.8.211 link=yes multicast=yes
        *-communication
             description: Communication controller
             product: Virtio console
             vendor: Red Hat, Inc.
             physical id: 4
             bus info: pci@0000:00:04.0
             version: 00
             width: 32 bits
             clock: 33MHz
             capabilities: msix bus_master cap_list
             configuration: driver=virtio-pci latency=0
             resources: irq:11 ioport:c080(size=32) memory:febd2000-febd2fff
           *-virtio1 UNCLAIMED
                description: Virtual I/O device
                physical id: 0
                bus info: virtio@1
                configuration: driver=virtio_console
        *-scsi
             description: SCSI storage controller
             product: Virtio block device
             vendor: Red Hat, Inc.
             physical id: 5
             bus info: pci@0000:00:05.0
             version: 00
             width: 32 bits
             clock: 33MHz
             capabilities: scsi msix bus_master cap_list
             configuration: driver=virtio-pci latency=0
             resources: irq:10 ioport:c000(size=64) memory:febd3000-febd3fff
           *-virtio2
                description: Virtual I/O device
                physical id: 0
                bus info: virtio@2
                logical name: /dev/vda
                size: 40GiB (42GB)
                capabilities: partitioned partitioned:dos
                configuration: driver=virtio_blk logicalsectorsize=512 sectorsize=512 signature=0008d73a
              *-volume
                   description: EXT4 volume
                   vendor: Linux
                   physical id: 1
                   bus info: virtio@2,1
                   logical name: /dev/vda1
                   logical name: /
                   logical name: /var/lib/docker/containers
                   logical name: /var/lib/docker/overlay2
                   version: 1.0
                   serial: eb448abb-3012-4d8d-bcde-94434d586a31
                   size: 39GiB
                   capacity: 39GiB
                   capabilities: primary bootable journaled extended_attributes large_files huge_files dir_nlink recover extents ext4 ext2 initialized
                   configuration: created=2017-10-15 23:18:59 filesystem=ext4 lastmountpoint=/ modified=2019-06-26 23:34:59 mount.fstype=ext4 mount.options=rw,relatime,data=ordered mounted=2019-06-26 15:35:03 state=mounted
        *-generic
             description: Unclassified device
             product: Virtio memory balloon
             vendor: Red Hat, Inc.
             physical id: 6
             bus info: pci@0000:00:06.0
             version: 00
             width: 32 bits
             clock: 33MHz
             capabilities: bus_master
             configuration: driver=virtio-pci latency=0
             resources: irq:11 ioport:c0a0(size=32)
           *-virtio3 UNCLAIMED
                description: Virtual I/O device
                physical id: 0
                bus info: virtio@3
                configuration: driver=virtio_balloon
     *-pnp00:00
          product: PnP device PNP0b00
          physical id: 1
          capabilities: pnp
          configuration: driver=rtc_cmos
     *-pnp00:01
          product: PnP device PNP0303
          physical id: 2
          capabilities: pnp
          configuration: driver=i8042 kbd
     *-pnp00:02
          product: PnP device PNP0f13
          physical id: 3
          capabilities: pnp
          configuration: driver=i8042 aux
     *-pnp00:03
          product: PnP device PNP0700
          physical id: 4
          capabilities: pnp
     *-pnp00:04
          product: PnP device PNP0501
          physical id: 5
          capabilities: pnp
          configuration: driver=serial
  *-network:0
       description: Ethernet interface
       physical id: 1
       logical name: vethfe4b025
       serial: f2:27:43:49:86:e7
       size: 10Gbit/s
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full link=yes multicast=yes port=twisted pair speed=10Gbit/s
  *-network:1
       description: Ethernet interface
       physical id: 2
       logical name: docker0
       serial: 02:42:20:2b:43:9d
       capabilities: ethernet physical
       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.17.0.1 link=yes multicast=yes

PCIe

  • PCI Express (Peripheral Component Interconnect Express, PCIe or PCI-e) 一种高速串行计算机扩展总线标准,旨在取代旧的 PCI、PCI-X 和 AGP 总线标准
  • PCIe 不同版本链路性能对照表(参考
    • GT/s, Giga transation per second(千兆传输/秒) 每一秒内传输的次数
      • 描述物理层通信协议的速率属性,可以不和链路宽度等关联
    • Gbps, Giga Bits Per Second (千兆位/秒)
      • GT/sGbps 之间不存在成比例的换算关系
      • 吞吐量 = 传输速率 * 编码方案
PCI Express link performance
  • 查看电脑的 PCIe 设备
$ lspci | grep "PCI bridge"
...
07:00.0 PCI bridge: PLX Technology, Inc. PEX 8732 32-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch (rev ca)
08:01.0 PCI bridge: PLX Technology, Inc. PEX 8732 32-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch (rev ca)
...
$ lspci -tv
$ lspci | grep --color 82599
06:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)
06:00.1 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数