# Conocer el hardware en linea de comandos (shell) # Comandos para identificar hardware y configuraciones especificas ## Hardware ### Información procesador ``` # grep 'vendor_id' /proc/cpuinfo ; grep 'model name' /proc/cpuinfo ; grep 'cpu MHz' /proc/cpuinfo vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel vendor_id : GenuineIntel model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz model name : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz cpu MHz : 848.767 cpu MHz : 950.482 cpu MHz : 800.024 cpu MHz : 869.512 cpu MHz : 823.590 cpu MHz : 800.024 cpu MHz : 799.822 cpu MHz : 851.184 cpu MHz : 802.642 cpu MHz : 1182.916 cpu MHz : 1121.081 cpu MHz : 802.441 ``` ### Marca procesador Si el procesdor es intel el comando de abajo devolvera algo ``` # grep -i vmx /proc/cpuinfo ``` Si el procesador es AMD el comnado de abjo devolverá algo ``` # grep -i svm /proc/cpuinfo ``` ### Discos duros #### lsblk (info particiones) ``` lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 3,7T 0 disk ├─sda1 8:1 0 511M 0 part /boot/efi ├─sda2 8:2 0 50G 0 part │ └─md2 9:2 0 50G 0 raid1 / ├─sda3 8:3 0 511M 0 part [SWAP] ├─sda4 8:4 0 1000G 0 part │ └─md4 9:4 0 1000G 0 raid1 /var └─sda5 8:5 0 2,6T 0 part └─md5 9:5 0 2,6T 0 raid1 /home sdb 8:16 0 3,7T 0 disk ├─sdb1 8:17 0 511M 0 part ├─sdb2 8:18 0 50G 0 part │ └─md2 9:2 0 50G 0 raid1 / ├─sdb3 8:19 0 511M 0 part [SWAP] ├─sdb4 8:20 0 1000G 0 part │ └─md4 9:4 0 1000G 0 raid1 /var └─sdb5 8:21 0 2,6T 0 part └─md5 9:5 0 2,6T 0 raid1 /home loop0 7:0 0 2,2G 0 loop /var/tmp ``` #### Discos duros (Atributos) ``` # blkid /dev/md4: LABEL="/var" UUID="bfa920a1-48e4-4d4e-ad9a-1f5289ec630e" TYPE="ext4" /dev/sdb4: UUID="0ceedb71-9478-ba95-a4d2-adc226fd5302" TYPE="linux_raid_member" PARTLABEL="logical" PARTUUID="9ba975e1-1b14-49d3-8971-b936e8d5e4e4" /dev/sda4: UUID="0ceedb71-9478-ba95-a4d2-adc226fd5302" TYPE="linux_raid_member" PARTLABEL="logical" PARTUUID="66b5b2c5-7be1-49e5-a792-9f87e2f7b4f5" /dev/sda1: LABEL="EFI_SYSPART" UUID="42B6-5CF2" TYPE="vfat" PARTLABEL="primary" PARTUUID="da4d4fc9-d837-41d9-a107-e742798f9335" /dev/sda2: UUID="facf2df2-7b51-d62e-a4d2-adc226fd5302" TYPE="linux_raid_member" PARTLABEL="primary" PARTUUID="d9d59890-5495-4d5c-b1a1-9c7cb06ea760" /dev/sda3: LABEL="swap-sda3" UUID="b3455011-b526-4882-9103-53aea1ba8861" TYPE="swap" PARTLABEL="primary" PARTUUID="b5bd8cbf-6bd4-484d-a66f-95e026322fe3" /dev/sda5: UUID="8841cb2a-ce20-324b-a4d2-adc226fd5302" TYPE="linux_raid_member" PARTLABEL="logical" PARTUUID="0a0c4007-1aa6-4bbd-8c94-b059e5e47a0e" /dev/sdb1: LABEL="EFI_SYSPART" UUID="42EC-11F4" TYPE="vfat" PARTLABEL="primary" PARTUUID="96828372-cc5c-4f44-bfc4-0758c394b1bb" /dev/sdb2: UUID="facf2df2-7b51-d62e-a4d2-adc226fd5302" TYPE="linux_raid_member" PARTLABEL="primary" PARTUUID="ea54dfc3-e5c8-4436-be12-9515d1f1f0f1" /dev/sdb3: LABEL="swap-sdb3" UUID="7bf2c3e0-e995-4dbf-9edf-de91db5cc4e0" TYPE="swap" PARTLABEL="primary" PARTUUID="0581737a-20c0-44b7-957c-6190b583f1af" /dev/sdb5: UUID="8841cb2a-ce20-324b-a4d2-adc226fd5302" TYPE="linux_raid_member" PARTLABEL="logical" PARTUUID="c02afe0d-c242-4dd9-8ec7-77ecd90e510b" /dev/md2: LABEL="/" UUID="424a9e66-51b2-4947-97b2-0d632d79a97f" TYPE="ext4" /dev/md5: LABEL="/home" UUID="0de14a77-8d9e-4f25-9c1b-bec542d45f22" TYPE="ext4" /dev/loop0: UUID="8fa0ffb8-aaa1-4321-9d4f-d55a9b021bcc" TYPE="ext3" ``` #### Estado solido o mecánico Devuelve 0 por SSD y 1 por discos mencánicos ``` cat /sys/block/sda/queue/rotational ``` #### Discos NVMe Necesitamos ewl paquete (Ubuntu) nmve-cli para comprobar discos de tipo NVMe ``` # nvme list Node SN Model Namespace Usage Format FW Rev ---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- -------- /dev/nvme0n1 S439NE0N101969 SAMSUNG MZQLB1T9HAJR-00007 1 958.95 GB / 1.92 TB 512 B + 0 B EDA5202Q /dev/nvme1n1 S439NE0N101968 SAMSUNG MZQLB1T9HAJR-00007 1 1.69 TB / 1.92 TB 512 B + 0 B EDA5202Q ``` #### Discos duros (hdparam) El comando hdparm puede que no este instalado en tu distribución. ``` yum install hdparm -y ``` ``` # hdparm -I /dev/sda /dev/sda: ATA device, with non-removable media Model Number: HGST HUS726040ALA610 Serial Number: N8GNY2YY Firmware Revision: A5GNT920 Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0; Revision: ATA8-AST T13 Project D1697 Revision 0b Standards: Used: unknown (minor revision code 0x0029) Supported: 9 8 7 6 5 Likely used: 9 Configuration: Logical max current cylinders 16383 16383 heads 16 16 sectors/track 63 63 -- CHS current addressable sectors: 16514064 LBA user addressable sectors: 268435455 LBA48 user addressable sectors: 7814037168 Logical Sector size: 512 bytes Physical Sector size: 512 bytes device size with M = 1024*1024: 3815447 MBytes device size with M = 1000*1000: 4000787 MBytes (4000 GB) cache/buffer size = unknown Form Factor: 3.5 inch Nominal Media Rotation Rate: 7200 Capabilities: LBA, IORDY(can be disabled) Queue depth: 32 Standby timer values: spec'd by Standard, no device specific minimum R/W multiple sector transfer: Max = 16 Current = 16 Advanced power management level: 254 DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 Cycle time: min=120ns recommended=120ns PIO: pio0 pio1 pio2 pio3 pio4 Cycle time: no flow control=120ns IORDY flow control=120ns Commands/features: Enabled Supported: * SMART feature set Security Mode feature set * Power Management feature set * Write cache * Look-ahead * Host Protected Area feature set * WRITE_BUFFER command * READ_BUFFER command * NOP cmd * DOWNLOAD_MICROCODE * Advanced Power Management feature set Power-Up In Standby feature set * SET_FEATURES required to spinup after power up SET_MAX security extension * 48-bit Address feature set * Device Configuration Overlay feature set * Mandatory FLUSH_CACHE * FLUSH_CACHE_EXT * SMART error logging * SMART self-test * Media Card Pass-Through * General Purpose Logging feature set * WRITE_{DMA|MULTIPLE}_FUA_EXT * 64-bit World wide name * URG for READ_STREAM[_DMA]_EXT * URG for WRITE_STREAM[_DMA]_EXT * WRITE_UNCORRECTABLE_EXT command * {READ,WRITE}_DMA_EXT_GPL commands * Segmented DOWNLOAD_MICROCODE * unknown 119[6] unknown 119[7] * Gen1 signaling speed (1.5Gb/s) * Gen2 signaling speed (3.0Gb/s) * Gen3 signaling speed (6.0Gb/s) * Native Command Queueing (NCQ) * Host-initiated interface power management * Phy event counters * NCQ priority information * unknown 76[15] Non-Zero buffer offsets in DMA Setup FIS * DMA Setup Auto-Activate optimization Device-initiated interface power management In-order data delivery * Software settings preservation unknown 78[7] unknown 78[10] unknown 78[11] * SMART Command Transport (SCT) feature set * SCT Write Same (AC2) * SCT Error Recovery Control (AC3) * SCT Features Control (AC4) * SCT Data Tables (AC5) * reserved 69[3] * reserved 69[4] * WRITE BUFFER DMA command * READ BUFFER DMA command Security: Master password revision code = 65534 supported not enabled not locked not frozen not expired: security count not supported: enhanced erase Logical Unit WWN Device Identifier: 5000cca244c984a4 NAA : 5 IEEE OUI : 000cca Unique ID : 244c984a4 Checksum: correct ``` ### lshw ``` lshw -class disk -class storage *-sata description: SATA controller product: Cannon Lake PCH SATA AHCI Controller vendor: Intel Corporation physical id: 17 bus info: pci@0000:00:17.0 logical name: scsi0 logical name: scsi1 version: 10 width: 32 bits clock: 66MHz capabilities: sata msi pm ahci_1.0 bus_master cap_list emulated configuration: driver=ahci latency=0 resources: irq:125 memory:91200000-91201fff memory:91203000-912030ff ioport:4050(size=8) ioport:4040(size=4) ioport:4020(size=32) memory:91202000-912027ff *-disk:0 description: ATA Disk product: HGST HUS726040AL physical id: 0 bus info: scsi@0:0.0.0 logical name: /dev/sda version: T920 serial: N8GNY2YY size: 3726GiB (4TB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=5 guid=9aa4231a-644b-40c9-9105-0e980dbeeeaa logicalsectorsize=512 sectorsize=512 *-disk:1 description: ATA Disk product: HGST HUS726040AL physical id: 1 bus info: scsi@1:0.0.0 logical name: /dev/sdb version: T920 serial: K4KRJ0KB size: 3726GiB (4TB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=5 guid=2c1a29d1-8bb6-4d02-9990-b9f2fb7b3414 logicalsectorsize=512 sectorsize=512 ``` ``` # lshw -short -C disk H/W path Device Class Description ==================================================== /0/100/17/0 /dev/sda disk 4TB HGST HUS726040AL /0/100/17/1 /dev/sdb disk 4TB HGST HUS726040AL ``` ### smartctl Importante para ver el estado de tus discos. Sobre todo cuando compras o alquilas hardware ``` smartctl -d ata -a -i /dev/sda smartctl 7.0 2018-12-30 r4883 [x86_64-linux-3.10.0-962.3.2.lve1.5.49.el7.x86_64] (local build) Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Family: HGST Ultrastar 7K6000 Device Model: HGST HUS726040ALA610 Serial Number: N8GNY2YY LU WWN Device Id: 5 000cca 244c984a4 Firmware Version: A5GNT920 User Capacity: 4.000.787.030.016 bytes [4,00 TB] Sector Size: 512 bytes logical/physical Rotation Rate: 7200 rpm Form Factor: 3.5 inches Device is: In smartctl database [for details use: -P show] ATA Version is: ACS-2, ATA8-ACS T13/1699-D revision 4 SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s) Local Time is: Sun May 16 17:57:14 2021 CEST SMART support is: Available - device has SMART capability. SMART support is: Enabled === START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED General SMART Values: Offline data collection status: (0x84) Offline data collection activity was suspended by an interrupting command from host. Auto Offline Data Collection: Enabled. Self-test execution status: ( 0) The previous self-test routine completed without error or no self-test has ever been run. Total time to complete Offline data collection: ( 113) seconds. Offline data collection capabilities: (0x5b) SMART execute Offline immediate. Auto Offline data collection on/off support. Suspend Offline collection upon new command. Offline surface scan supported. Self-test supported. No Conveyance Self-test supported. Selective Self-test supported. SMART capabilities: (0x0003) Saves SMART data before entering power-saving mode. Supports SMART auto save timer. Error logging capability: (0x01) Error logging supported. General Purpose Logging supported. Short self-test routine recommended polling time: ( 2) minutes. Extended self-test routine recommended polling time: ( 571) minutes. SCT capabilities: (0x003d) SCT Status supported. SCT Error Recovery Control supported. SCT Feature Control supported. SCT Data Table supported. SMART Attributes Data Structure revision number: 16 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x000b 100 100 016 Pre-fail Always - 0 2 Throughput_Performance 0x0005 135 135 054 Pre-fail Offline - 112 3 Spin_Up_Time 0x0007 184 184 024 Pre-fail Always - 265 (Average 315) 4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 80 5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0 7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0 8 Seek_Time_Performance 0x0005 128 128 020 Pre-fail Offline - 18 9 Power_On_Hours 0x0012 097 097 000 Old_age Always - 27686 10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 75 192 Power-Off_Retract_Count 0x0032 080 080 000 Old_age Always - 24197 193 Load_Cycle_Count 0x0012 080 080 000 Old_age Always - 24197 194 Temperature_Celsius 0x0002 162 162 000 Old_age Always - 37 (Min/Max 19/52) 196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0 197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0 SMART Error Log Version: 1 No Errors Logged SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Short offline Completed without error 00% 26073 - # 2 Short offline Completed without error 00% 26058 - # 3 Short offline Completed without error 00% 26058 - # 4 Short offline Completed without error 00% 16865 - # 5 Short offline Completed without error 00% 16850 - # 6 Short offline Completed without error 00% 16850 - # 7 Short offline Completed without error 00% 15329 - # 8 Short offline Completed without error 00% 15314 - # 9 Short offline Completed without error 00% 15314 - #10 Short offline Completed without error 00% 15288 - #11 Short offline Completed without error 00% 15278 - #12 Short offline Completed without error 00% 15264 - #13 Short offline Completed without error 00% 15264 - #14 Short offline Completed without error 00% 15249 - #15 Short offline Completed without error 00% 15249 - #16 Short offline Completed without error 00% 15099 - #17 Short offline Completed without error 00% 29 - #18 Short offline Completed without error 00% 23 - #19 Short offline Completed without error 00% 23 - #20 Short offline Completed without error 00% 2 - SMART Selective self-test log data structure revision number 1 SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS 1 0 0 Not_testing 2 0 0 Not_testing 3 0 0 Not_testing 4 0 0 Not_testing 5 0 0 Not_testing Selective self-test flags (0x0): After scanning selected spans, do NOT read-scan remainder of disk. If Selective self-test is pending on power-up, resume after 0 minute delay. ``` #### Estado del RAID pro software ``` cat /proc/mdstat Personalities : [raid1] md5 : active raid1 sda5[0] sdb5[1] 2804960192 blocks [2/2] [UU] bitmap: 12/21 pages [48KB], 65536KB chunk md4 : active raid1 sdb4[1] sda4[0] 1048573888 blocks [2/2] [UU] bitmap: 4/8 pages [16KB], 65536KB chunk md2 : active raid1 sdb2[1] sda2[0] 52427712 blocks [2/2] [UU] ``` ### Hardware información general #### Hardware información general resumida ``` # lshw -short H/W path Device Class Description ==================================================== system To Be Filled By O.E.M. (To Be Filled By O.E.M.) /0 bus E3C242D4U2-2T /0/0 memory 64KiB BIOS /0/9 memory 32GiB System Memory /0/9/0 memory 16GiB DIMM DDR4 Synchronous 2666 MHz (0,4 ns) /0/9/1 memory DIMM [empty] /0/9/2 memory 16GiB DIMM DDR4 Synchronous 2666 MHz (0,4 ns) /0/9/3 memory DIMM [empty] /0/14 memory 384KiB L1 cache /0/15 memory 1536KiB L2 cache /0/16 memory 12MiB L3 cache /0/17 processor Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz /0/100 bridge 8th Gen Core Processor Host Bridge/DRAM Registers /0/100/8 generic Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model /0/100/12 generic Cannon Lake PCH Thermal Controller /0/100/14 bus Cannon Lake PCH USB 3.1 xHCI Host Controller /0/100/14/0 usb1 bus xHCI Host Controller /0/100/14/1 usb2 bus xHCI Host Controller /0/100/14.2 memory RAM memory /0/100/15 bus Cannon Lake PCH Serial IO I2C Controller #0 /0/100/15.1 bus Cannon Lake PCH Serial IO I2C Controller #1 /0/100/16 communication Cannon Lake PCH HECI Controller /0/100/16.4 communication Cannon Lake PCH HECI Controller #2 /0/100/17 scsi0 storage Cannon Lake PCH SATA AHCI Controller /0/100/17/0 /dev/sda disk 4TB HGST HUS726040AL /0/100/17/0/1 /dev/sda1 volume 510MiB Windows FAT volume /0/100/17/0/2 /dev/sda2 volume 49GiB EXT4 volume /0/100/17/0/3 /dev/sda3 volume 510MiB Linux swap volume /0/100/17/0/4 /dev/sda4 volume 999GiB EXT4 volume /0/100/17/0/5 /dev/sda5 volume 2675GiB EXT4 volume /0/100/17/1 /dev/sdb disk 4TB HGST HUS726040AL /0/100/17/1/1 /dev/sdb1 volume 510MiB Windows FAT volume /0/100/17/1/2 /dev/sdb2 volume 49GiB EXT4 volume /0/100/17/1/3 /dev/sdb3 volume 510MiB Linux swap volume /0/100/17/1/4 /dev/sdb4 volume 999GiB EXT4 volume /0/100/17/1/5 /dev/sdb5 volume 2675GiB EXT4 volume /0/100/1b bridge Cannon Lake PCH PCI Express Root Port #21 /0/100/1b/0 eth0 network Ethernet Controller 10G X550T /0/100/1b/0.1 eth1 network Ethernet Controller 10G X550T /0/100/1c bridge Cannon Lake PCH PCI Express Root Port #1 /0/100/1c/0 bridge AST1150 PCI-to-PCI Bridge /0/100/1c/0/0 display ASPEED Graphics Family /0/100/1d bridge Cannon Lake PCH PCI Express Root Port #9 /0/100/1e communication Cannon Lake PCH Serial IO UART Host Controller /0/100/1f bridge Intel Corporation /0/100/1f.4 bus Cannon Lake PCH SMBus Controller /0/100/1f.5 bus Cannon Lake PCH SPI Controller /0/1 system PnP device PNP0c02 /0/2 system PnP device PNP0c02 /0/3 communication PnP device PNP0501 /0/4 communication PnP device PNP0501 /0/5 system PnP device PNP0c02 /0/6 generic PnP device INT3f0d /0/7 system PnP device PNP0c02 /0/8 system PnP device PNP0c02 /0/a system PnP device PNP0c02 /0/b system PnP device PNP0c02 ``` #### Hardware información general detallada ``` # lshw | less ``` ### MegaCli MegaCli es una herramienta especifica de la familia de controladoras **LSI MegaRaid** Auqne muchos manuales idtentifican los caomando unas veces en minusculas, otros con alternacia de mayúsculas y minúsculas, lo qmejor es crear un alias, apuntado al que corresponda. Si te falla alguna información en al gun tip, que ves por internet esa es la razón. En mi caso uso MegaCli ya que hice en su día `ln -s /usr/sbin/megacli MegaCli` #### Conocer el estado de la controladora ``` root@pro02:~# MegaCli -EncInfo -aALL Number of enclosures on adapter 0 -- 1 Enclosure 0: Device ID : 252 Number of Slots : 8 Number of Power Supplies : 0 Number of Fans : 0 Number of Temperature Sensors : 0 Number of Alarms : 0 Number of SIM Modules : 1 Number of Physical Drives : 8 Status : Normal Position : 1 Connector Name : Unavailable Enclosure type : SGPIO FRU Part Number : N/A Enclosure Serial Number : N/A ESM Serial Number : N/A Enclosure Zoning Mode : N/A Partner Device Id : Unavailable Inquiry data : Vendor Identification : AVAGO Product Identification : SGPIO Product Revision Level : N/A Vendor Specific : Exit Code: 0x00 ``` ## Sistema ### Arquitectura lshw no tiene porque estar disponible en tu distribucion. Si es asi instalalo o busca alternativa. ``` # sudo lshw -C CPU | grep width width: 64 bits ``` ### Enlaces y agradecimientos - [How to find out Hard Disk Specks /Deatis on Linux](https://www.cyberciti.biz/faq/find-hard-disk-hardware-specs-on-linux/) - [Using NVMe Command Line Tools to Check NVMe Flash Health](https://www.percona.com/blog/2017/02/09/using-nvme-command-line-tools-to-check-nvme-flash-health/) ##### Aviso Esta documentación y su contenido, no implica que funcione en tu caso o determinados casos. También implica que tienes conocimientos sobre lo que trata, y que en cualquier caso tienes copias de seguridad. El contenido el contenido se entrega, tal y como está, sin que ello implique ningún obligación ni responsabilidad por parte de [Castris](https://castris.com) Si necesitas soporte profesional puedes contratar con Castris [soporte profesional](https://intranet.castris.com/cart.php?gid=18).