Ubuntu 22.04查看磁盘硬件信息命令

gowork 2024年5月15日 0

1. lsblk

$ lsblk
NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0                       7:0    0  63.9M  1 loop /snap/core20/2318
loop1                       7:1    0    87M  1 loop /snap/lxd/27948
loop2                       7:2    0  63.9M  1 loop /snap/core20/2264
loop3                       7:3    0    87M  1 loop /snap/lxd/28373
loop4                       7:4    0  39.1M  1 loop /snap/snapd/21184
loop5                       7:5    0  38.7M  1 loop /snap/snapd/21465
sda                         8:0    0 465.8G  0 disk 
├─sda1                      8:1    0     1M  0 part 
├─sda2                      8:2    0     2G  0 part /boot
└─sda3                      8:3    0 463.8G  0 part 
  └─ubuntu--vg-ubuntu--lv 253:0    0 463.8G  0 lvm  /

2. blkid

$ blkid
/dev/mapper/ubuntu--vg-ubuntu--lv: UUID="a1ff6803-c09c-4cd8-a67e-0ddb9e9dc0d5" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda2: UUID="cb4bfaf7-ca79-4d1d-998c-c5e59b27c22e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="69c68a44-27d1-4d72-a436-66b3df918541"
/dev/sda3: UUID="2M4zfg-hQBR-gZxp-T6DP-XMtv-h3Bo-i506De" TYPE="LVM2_member" PARTUUID="59cf10cd-3e5a-4e36-a2c1-c24fe579eff5"
/dev/loop1: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop0: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/sda1: PARTUUID="4ab55468-27db-4999-981b-0dc78ed921d0"

3. hdparm

$ sudo hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
	Model Number:       HGST HTS545050A7E380                    
	Serial Number:      TE85123Q3E5LDW
	Firmware Revision:  GG2OACD0
	Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6; Revision: ATA8-AST T13 Project D1697 Revision 0b
Standards:
	Used: unknown (minor revision code 0x0028) 
	Supported: 8 7 6 5 
	Likely used: 8
Configuration:
	Logical		max	current
	cylinders	16383	65535
	heads		16	1
	sectors/track	63	63
	--
	CHS current addressable sectors:     4128705
	LBA    user addressable sectors:   268435455
	LBA48  user addressable sectors:   976773168
	Logical  Sector size:                   512 bytes
	Physical Sector size:                  4096 bytes
	Logical Sector-0 offset:                  0 bytes
	device size with M = 1024*1024:      476940 MBytes
	device size with M = 1000*1000:      500107 MBytes (500 GB)
	cache/buffer size  = 8192 KBytes (type=DualPortCache)
	Form Factor: 2.5 inch
	Nominal Media Rotation Rate: 5400
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: 1
	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
	   *	General Purpose Logging feature set
	   *	WRITE_{DMA|MULTIPLE}_FUA_EXT
	   *	64-bit World wide name
	   *	IDLE_IMMEDIATE with UNLOAD
	   *	WRITE_UNCORRECTABLE_EXT command
	   *	{READ,WRITE}_DMA_EXT_GPL commands
	   *	Segmented DOWNLOAD_MICROCODE
	   *	Gen1 signaling speed (1.5Gb/s)
	   *	Gen2 signaling speed (3.0Gb/s)
	   *	Native Command Queueing (NCQ)
	   *	Host-initiated interface power management
	   *	Phy event counters
	   *	Idle-Unload when NCQ is active
	   *	NCQ priority information
	    	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
	   *	SMART Command Transport (SCT) feature set
	   *	SCT Write Same (AC2)
	   *	SCT Error Recovery Control (AC3)
	   *	SCT Features Control (AC4)
	   *	SCT Data Tables (AC5)
Security: 
	Master password revision code = 65534
		supported
	not	enabled
	not	locked
		frozen
	not	expired: security count
		supported: enhanced erase
	114min for SECURITY ERASE UNIT. 116min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000cca6e4f04455
	NAA		: 5
	IEEE OUI	: 000cca
	Unique ID	: 6e4f04455
Checksum: correct

4. lshw

$ lshw -class disk -class storage
 *-sata                    
       description: SATA controller
       product: 7 Series Chipset Family 6-port SATA Controller [AHCI mode]
       vendor: Intel Corporation
       physical id: 1f.2
       bus info: pci@0000:00:1f.2
       logical name: scsi0
       version: 04
       width: 32 bits
       clock: 66MHz
       capabilities: sata msi pm ahci_1.0 bus_master cap_list emulated
       configuration: driver=ahci latency=0
       resources: irq:26 ioport:60a8(size=8) ioport:60b4(size=4) ioport:60a0(size=8) ioport:60b0(size=4) ioport:6060(size=32) memory:f2538000-f25387ff
     *-disk
          description: ATA Disk
          product: HGST HTS545050A7
          physical id: 0.0.0
          bus info: scsi@0:0.0.0
          logical name: /dev/sda
          version: ACD0
          serial: TE85123Q3E5LDW
          size: 465GiB (500GB)
          capabilities: gpt-1.00 partitioned partitioned:gpt
          configuration: ansiversion=5 guid=f9431bc4-69a0-4c10-b757-8b303cad8b4f logicalsectorsize=512 sectorsize=4096

5. fdisk

$ fdisk -l
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: HGST HTS545050A7
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: F9431BC4-69A0-4C10-B757-8B303CAD8B4F

Device       Start       End   Sectors   Size Type
/dev/sda1     2048      4095      2048     1M BIOS boot
/dev/sda2     4096   4198399   4194304     2G Linux filesystem
/dev/sda3  4198400 976771071 972572672 463.8G Linux filesystem

6. smartctl

$ smartctl -d ata -a -i /dev/sda
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-106-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Hitachi/HGST Travelstar Z5K500
Device Model:     HGST HTS545050A7E380
Serial Number:    TE85123Q3E5LDW
LU WWN Device Id: 5 000cca 6e4f04455
Firmware Version: GG2OACD0
User Capacity:    500,107,862,016 bytes [500 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 6
SATA Version is:  SATA 2.6, 3.0 Gb/s
Local Time is:    Wed May 15 12:46:32 2024 UTC
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:  (0x00)	Offline data collection activity
					was never started.
					Auto Offline Data Collection: Disabled.
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: 		(   45) 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: 	 ( 115) 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   062    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0005   100   100   040    Pre-fail  Offline      -       0
  3 Spin_Up_Time            0x0007   253   253   033    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0012   053   053   000    Old_age   Always       -       74559
  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   100   100   040    Pre-fail  Offline      -       0
  9 Power_On_Hours          0x0012   093   093   000    Old_age   Always       -       3440
 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   099   099   000    Old_age   Always       -       2622
191 G-Sense_Error_Rate      0x000a   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       74
193 Load_Cycle_Count        0x0012   071   071   000    Old_age   Always       -       293402
194 Temperature_Celsius     0x0002   136   136   000    Old_age   Always       -       44 (Min/Max 8/45)
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       -       1
223 Load_Retry_Count        0x000a   100   100   000    Old_age   Always       -       0

SMART Error Log Version: 1
ATA Error Count: 5
	CR = Command Register [HEX]
	FR = Features Register [HEX]
	SC = Sector Count Register [HEX]
	SN = Sector Number Register [HEX]
	CL = Cylinder Low Register [HEX]
	CH = Cylinder High Register [HEX]
	DH = Device/Head Register [HEX]
	DC = Device Command Register [HEX]
	ER = Error register [HEX]
	ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 5 occurred at disk power-on lifetime: 2004 hours (83 days + 12 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 08 c8 8b 90 00  Error: UNC at LBA = 0x00908bc8 = 9472968

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 08 00 c8 8b 90 40 00      00:00:53.618  READ FPDMA QUEUED
  2f 00 01 10 00 00 28 00      00:00:53.603  READ LOG EXT
  60 08 00 c8 8b 90 40 00      00:00:50.063  READ FPDMA QUEUED
  2f 00 01 10 00 00 28 00      00:00:50.047  READ LOG EXT
  60 08 00 c8 8b 90 40 00      00:00:46.518  READ FPDMA QUEUED

Error 4 occurred at disk power-on lifetime: 2004 hours (83 days + 12 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 08 c8 8b 90 00  Error: UNC at LBA = 0x00908bc8 = 9472968

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 08 00 c8 8b 90 40 00      00:00:50.063  READ FPDMA QUEUED
  2f 00 01 10 00 00 28 00      00:00:50.047  READ LOG EXT
  60 08 00 c8 8b 90 40 00      00:00:46.518  READ FPDMA QUEUED
  2f 00 01 10 00 00 28 00      00:00:46.503  READ LOG EXT
  60 08 00 c8 8b 90 40 00      00:00:42.996  READ FPDMA QUEUED

Error 3 occurred at disk power-on lifetime: 2004 hours (83 days + 12 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 08 c8 8b 90 00  Error: UNC at LBA = 0x00908bc8 = 9472968

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 08 00 c8 8b 90 40 00      00:00:46.518  READ FPDMA QUEUED
  2f 00 01 10 00 00 28 00      00:00:46.503  READ LOG EXT
  60 08 00 c8 8b 90 40 00      00:00:42.996  READ FPDMA QUEUED
  60 08 00 c0 8b 90 40 00      00:00:42.996  READ FPDMA QUEUED
  60 08 00 b8 8b 90 40 00      00:00:42.995  READ FPDMA QUEUED

Error 2 occurred at disk power-on lifetime: 2004 hours (83 days + 12 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 08 c8 8b 90 00  Error: UNC at LBA = 0x00908bc8 = 9472968

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 08 00 c8 8b 90 40 00      00:00:42.996  READ FPDMA QUEUED
  60 08 00 c0 8b 90 40 00      00:00:42.996  READ FPDMA QUEUED
  60 08 00 b8 8b 90 40 00      00:00:42.995  READ FPDMA QUEUED
  60 08 00 b0 8b 90 40 00      00:00:42.994  READ FPDMA QUEUED
  60 08 00 a8 8b 90 40 00      00:00:42.993  READ FPDMA QUEUED

Error 1 occurred at disk power-on lifetime: 185 hours (7 days + 17 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 51 e1 d7 09 8a 01  Error: ICRC, ABRT 225 sectors at LBA = 0x018a09d7 = 25823703

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 00 b8 06 8a e0 00      00:00:02.008  READ DMA EXT
  25 00 00 b8 fe 89 e0 00      00:00:01.998  READ DMA EXT
  25 00 00 b8 f6 89 e0 00      00:00:01.980  READ DMA EXT
  25 00 00 b8 ee 89 e0 00      00:00:01.944  READ DMA EXT
  25 00 00 b8 e6 89 e0 00      00:00:01.927  READ DMA EXT

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%      2842         -
# 2  Short offline       Completed without error       00%      2842         -

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.