ubuntu 偶发启动失败问题分析

目录

工具编译

错误日志

磁盘日志1

磁盘日志2

盘信息对比

SATA链路复位

[ubuntu initrd重新制作](#ubuntu initrd重新制作)

加载文件系统的流程

磁盘丢失

电源管理

磁盘电源管理

加载报错日志

总结


工具编译

复制代码
~/smart/smartmontools-7.5$ ./configure LDFLAGS=-static

错误日志

4.740050 md: ... autorun DONE.

4.763126 UFS: Cannot open root device "UUID=2efb1792-a835-4997" or unknown-block(0,0): error -6

4.787462 Please append a correct "root=" boot option; here are the available partitions:

4.812125 Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

4.837047 CPU: 4 PID: 1 Comm: swapper/0 Not tainted

通常这种错误日志是由于系统文件出现损坏导致的,但这种为必现故障了。

磁盘日志1

Percentage Used Endurance Indicator = 0(SSD 统计页 0x07)→ 磨损几乎为零。

Reallocated_Sector_Ct = 0 → 无重映射坏块。

Power_On_Hours = 15、Power_Cycle_Count = 18 → 几乎全新,只通电 15 小时、开关机 18 次。

Total_LBAs_Written = 263、Total_LBAs_Read = 186(raw 值,单位取决于厂商;结合设备统计页:逻辑扇区写 17,268,464、读 12,218,884,约 8.8 GB 写 / 6.2 GB 读,非常少)

Power-Off_Retract_Count 13次,即18次中有13次是异常断电。

复制代码
smartctl 7.5 2025-04-30 r5714 [x86_64-linux-5.11.0-27-generic] (local build)
Copyright (C) 2002-25, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     CFast 3TE7
Serial Number:    YCA12506050350455
LU WWN Device Id: 5 24693e 003221657
Firmware Version: S24306
User Capacity:    240,057,409,536 bytes [240 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic, zeroed
Device is:        Not in smartctl database 7.5/5706
ATA Version is:   ACS-3 (minor revision not indicated)
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Jul 22 03:08:41 2021 CST
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: 		(   33) seconds.
Offline data collection
capabilities: 			 (0x7b) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					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: 	 (   2) minutes.
Conveyance self-test routine
recommended polling time: 	 (   2) minutes.
SCT capabilities: 	       (0x0031)	SCT Status 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
  5 Reallocated_Sector_Ct   0x0012   100   100   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0012   015   100   000    Old_age   Always       -       15
 12 Power_Cycle_Count       0x0012   018   000   000    Old_age   Always       -       18
163 Unknown_Attribute       0x0012   047   000   000    Old_age   Always       -       47
165 Unknown_Attribute       0x0012   003   000   000    Old_age   Always       -       3
167 Unknown_Attribute       0x0012   001   000   000    Old_age   Always       -       1
169 Unknown_Attribute       0x0000   100   000   000    Old_age   Offline      -       100
170 Unknown_Attribute       0x0013   100   100   001    Pre-fail  Always       -       213
171 Unknown_Attribute       0x0012   000   100   000    Old_age   Always       -       0
172 Unknown_Attribute       0x0012   000   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0012   013   000   000    Old_age   Always       -       13
194 Temperature_Celsius     0x0002   046   100   000    Old_age   Always       -       46 (3 51 0 23 0)
229 Unknown_Attribute       0x0000   100   100   000    Old_age   Offline      -       125854144806040
235 Unknown_Attribute       0x0002   000   000   000    Old_age   Always       -       0
241 Total_LBAs_Written      0x0012   100   100   000    Old_age   Always       -       263
242 Total_LBAs_Read         0x0012   100   100   000    Old_age   Always       -       186

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

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.

The above only provides legacy SMART information - try 'smartctl -x' for more

smartctl 7.5 2025-04-30 r5714 [x86_64-linux-5.11.0-27-generic] (local build)
Copyright (C) 2002-25, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     CFast 3TE7
Serial Number:    YCA12506050350455
LU WWN Device Id: 5 24693e 003221657
Firmware Version: S24306
User Capacity:    240,057,409,536 bytes [240 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic, zeroed
Device is:        Not in smartctl database 7.5/5706
ATA Version is:   ACS-3 (minor revision not indicated)
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Jul 22 03:08:59 2021 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
AAM feature is:   Unavailable
APM feature is:   Unavailable
Rd look-ahead is: Enabled
Write cache is:   Enabled
DSN feature is:   Unavailable
ATA Security is:  Disabled, frozen [SEC2]

=== 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: 		(   33) seconds.
Offline data collection
capabilities: 			 (0x7b) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					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: 	 (   2) minutes.
Conveyance self-test routine
recommended polling time: 	 (   2) minutes.
SCT capabilities: 	       (0x0031)	SCT Status 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          FLAGS    VALUE WORST THRESH FAIL RAW_VALUE
  5 Reallocated_Sector_Ct   -O--C-   100   100   000    -    0
  9 Power_On_Hours          -O--C-   015   100   000    -    15
 12 Power_Cycle_Count       -O--C-   018   000   000    -    18
163 Unknown_Attribute       -O--C-   047   000   000    -    47
165 Unknown_Attribute       -O--C-   003   000   000    -    3
167 Unknown_Attribute       -O--C-   001   000   000    -    1
169 Unknown_Attribute       ------   100   000   000    -    100
170 Unknown_Attribute       PO--C-   100   100   001    -    213
171 Unknown_Attribute       -O--C-   000   100   000    -    0
172 Unknown_Attribute       -O--C-   000   100   000    -    0
192 Power-Off_Retract_Count -O--C-   013   000   000    -    13
194 Temperature_Celsius     -O----   046   100   000    -    46 (3 51 0 23 0)
229 Unknown_Attribute       ------   100   100   000    -    125854144806040
235 Unknown_Attribute       -O----   000   000   000    -    0
241 Total_LBAs_Written      -O--C-   100   100   000    -    263
242 Total_LBAs_Read         -O--C-   100   100   000    -    186
                            ||||||_ K auto-keep
                            |||||__ C event count
                            ||||___ R error rate
                            |||____ S speed/performance
                            ||_____ O updated online
                            |______ P prefailure warning

General Purpose Log Directory Version 1
SMART           Log Directory Version 1 [multi-sector log support]
Address    Access  R/W   Size  Description
0x00       GPL,SL  R/O      1  Log Directory
0x01           SL  R/O      1  Summary SMART error log
0x02           SL  R/O     51  Comprehensive SMART error log
0x03       GPL     R/O     64  Ext. Comprehensive SMART error log
0x04       GPL,SL  R/O      8  Device Statistics log
0x06           SL  R/O      1  SMART self-test log
0x07       GPL     R/O      1  Extended self-test log
0x09           SL  R/W      1  Selective self-test log
0x10       GPL     R/O      1  NCQ Command Error log
0x11       GPL     R/O      1  SATA Phy Event Counters log
0x30       GPL,SL  R/O      9  IDENTIFY DEVICE data log
0x80-0x9f  GPL,SL  R/W     16  Host vendor specific log
0xe0       GPL,SL  R/W      1  SCT Command/Status
0xe1       GPL,SL  R/W      1  SCT Data Transfer

SMART Extended Comprehensive Error Log Version: 1 (64 sectors)
No Errors Logged

SMART Extended Self-test Log Version: 1 (1 sectors)
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

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.

SCT Status Version:                  3
SCT Version (vendor specific):       1 (0x0001)
Device State:                        Active (0)
Current Temperature:                    46 Celsius
Power Cycle Min/Max Temperature:      ?/47 Celsius
Lifetime    Min/Max Temperature:      ?/ ? Celsius
Under/Over Temperature Limit Count:   0/0

SCT Temperature History Version:     2
Temperature Sampling Period:         1 minute
Temperature Logging Interval:        1 minute
Min/Max recommended Temperature:     -127/127 Celsius
Min/Max Temperature Limit:           -127/127 Celsius
Temperature History Size (Index):    478 (123)

Index    Estimated Time   Temperature Celsius
 124    2021-07-21 19:11    46  ***************************
 ...    ..( 10 skipped).    ..  ***************************
 135    2021-07-21 19:22    46  ***************************
 136    2021-07-21 19:23    47  ****************************
 137    2021-07-21 19:24    46  ***************************
 ...    ..( 57 skipped).    ..  ***************************
 195    2021-07-21 20:22    46  ***************************
 196    2021-07-21 20:23    47  ****************************
 ...    ..(  9 skipped).    ..  ****************************
 206    2021-07-21 20:33    47  ****************************
 207    2021-07-21 20:34     ?  -
 208    2021-07-21 20:35     ?  -
 209    2021-07-21 20:36     ?  -
 210    2021-07-21 20:37    40  *********************
 211    2021-07-21 20:38    41  **********************
 212    2021-07-21 20:39    42  ***********************
 213    2021-07-21 20:40    43  ************************
 214    2021-07-21 20:41    44  *************************
 215    2021-07-21 20:42    44  *************************
 216    2021-07-21 20:43    45  **************************
 217    2021-07-21 20:44    45  **************************
 218    2021-07-21 20:45    46  ***************************
 219    2021-07-21 20:46    46  ***************************
 220    2021-07-21 20:47    47  ****************************
 221    2021-07-21 20:48    47  ****************************
 222    2021-07-21 20:49    47  ****************************
 223    2021-07-21 20:50    48  *****************************
 ...    ..(  5 skipped).    ..  *****************************
 229    2021-07-21 20:56    48  *****************************
 230    2021-07-21 20:57    49  ******************************
 ...    ..(  5 skipped).    ..  ******************************
 236    2021-07-21 21:03    49  ******************************
 237    2021-07-21 21:04    50  *******************************
 ...    ..(  4 skipped).    ..  *******************************
 242    2021-07-21 21:09    50  *******************************
 243    2021-07-21 21:10    51  ********************************
 ...    ..( 24 skipped).    ..  ********************************
 268    2021-07-21 21:35    51  ********************************
 269    2021-07-21 21:36    47  ****************************
 270    2021-07-21 21:37    51  ********************************
 ...    ..( 17 skipped).    ..  ********************************
 288    2021-07-21 21:55    51  ********************************
 289    2021-07-21 21:56    50  *******************************
 ...    ..( 11 skipped).    ..  *******************************
 301    2021-07-21 22:08    50  *******************************
 302    2021-07-21 22:09    49  ******************************
 ...    ..(  6 skipped).    ..  ******************************
 309    2021-07-21 22:16    49  ******************************
 310    2021-07-21 22:17    48  *****************************
 311    2021-07-21 22:18    48  *****************************
 312    2021-07-21 22:19    49  ******************************
 313    2021-07-21 22:20    48  *****************************
 314    2021-07-21 22:21    49  ******************************
 ...    ..( 16 skipped).    ..  ******************************
 331    2021-07-21 22:38    49  ******************************
 332    2021-07-21 22:39    48  *****************************
 ...    ..(  4 skipped).    ..  *****************************
 337    2021-07-21 22:44    48  *****************************
 338    2021-07-21 22:45    49  ******************************
 339    2021-07-21 22:46    48  *****************************
 340    2021-07-21 22:47    49  ******************************
 ...    ..(  8 skipped).    ..  ******************************
 349    2021-07-21 22:56    49  ******************************
 350    2021-07-21 22:57    48  *****************************
 ...    ..( 25 skipped).    ..  *****************************
 376    2021-07-21 23:23    48  *****************************
 377    2021-07-21 23:24    49  ******************************
 ...    ..(  5 skipped).    ..  ******************************
 383    2021-07-21 23:30    49  ******************************
 384    2021-07-21 23:31    50  *******************************
 ...    ..( 49 skipped).    ..  *******************************
 434    2021-07-22 00:21    50  *******************************
 435    2021-07-22 00:22    49  ******************************
 ...    ..(  4 skipped).    ..  ******************************
 440    2021-07-22 00:27    49  ******************************
 441    2021-07-22 00:28    48  *****************************
 ...    ..(  6 skipped).    ..  *****************************
 448    2021-07-22 00:35    48  *****************************
 449    2021-07-22 00:36    46  ***************************
 450    2021-07-22 00:37    48  *****************************
 ...    ..( 36 skipped).    ..  *****************************
   9    2021-07-22 01:14    48  *****************************
  10    2021-07-22 01:15    47  ****************************
 ...    ..( 35 skipped).    ..  ****************************
  46    2021-07-22 01:51    47  ****************************
  47    2021-07-22 01:52    48  *****************************
  48    2021-07-22 01:53    48  *****************************
  49    2021-07-22 01:54    48  *****************************
  50    2021-07-22 01:55    47  ****************************
 ...    ..(  2 skipped).    ..  ****************************
  53    2021-07-22 01:58    47  ****************************
  54    2021-07-22 01:59    48  *****************************
 ...    ..(  3 skipped).    ..  *****************************
  58    2021-07-22 02:03    48  *****************************
  59    2021-07-22 02:04    47  ****************************
 ...    ..( 16 skipped).    ..  ****************************
  76    2021-07-22 02:21    47  ****************************
  77    2021-07-22 02:22     ?  -
  78    2021-07-22 02:23    44  *************************
  79    2021-07-22 02:24    41  **********************
  80    2021-07-22 02:25    44  *************************
  81    2021-07-22 02:26    45  **************************
  82    2021-07-22 02:27    45  **************************
  83    2021-07-22 02:28    45  **************************
  84    2021-07-22 02:29    46  ***************************
 ...    ..(  8 skipped).    ..  ***************************
  93    2021-07-22 02:38    46  ***************************
  94    2021-07-22 02:39    47  ****************************
 ...    ..( 12 skipped).    ..  ****************************
 107    2021-07-22 02:52    47  ****************************
 108    2021-07-22 02:53    46  ***************************
 ...    ..(  4 skipped).    ..  ***************************
 113    2021-07-22 02:58    46  ***************************
 114    2021-07-22 02:59     ?  -
 115    2021-07-22 03:00    46  ***************************
 116    2021-07-22 03:01    46  ***************************
 117    2021-07-22 03:02    47  ****************************
 118    2021-07-22 03:03    46  ***************************
 ...    ..(  4 skipped).    ..  ***************************
 123    2021-07-22 03:08    46  ***************************

SCT Error Recovery Control command not supported

Device Statistics (GP Log 0x04)
Page  Offset Size        Value Flags Description
0x01  =====  =               =  ===  == General Statistics (rev 1) ==
0x01  0x008  4              18  ---  Lifetime Power-On Resets
0x01  0x010  4              15  ---  Power-on Hours
0x01  0x018  6        17268464  ---  Logical Sectors Written
0x01  0x020  6           47633  ---  Number of Write Commands
0x01  0x028  6        12218884  ---  Logical Sectors Read
0x01  0x030  6          157933  ---  Number of Read Commands
0x01  0x038  6     12939459388  ---  Date and Time TimeStamp
0x07  =====  =               =  ===  == Solid State Device Statistics (rev 1) ==
0x07  0x008  1               0  N--  Percentage Used Endurance Indicator
                                |||_ C monitored condition met
                                ||__ D supports DSN
                                |___ N normalized value

Pending Defects log (GP Log 0x0c) not supported

SATA Phy Event Counters (GP Log 0x11)
ID      Size     Value  Description
0x0001  2            0  Command failed due to ICRC error
0x0003  2            0  R_ERR response for device-to-host data FIS
0x0004  2            0  R_ERR response for host-to-device data FIS
0x0006  2            0  R_ERR response for device-to-host non-data FIS
0x0007  2            0  R_ERR response for host-to-device non-data FIS
0x0008  2            0  Device-to-host non-data FIS retries
0x0009  4            0  Transition from drive PhyRdy to drive PhyNRdy
0x000a  4            4  Device-to-host register FISes sent due to a COMRESET
0x000f  2            0  R_ERR response for host-to-device data FIS, CRC
0x0010  2            0  R_ERR response for host-to-device data FIS, non-CRC
0x0012  2            0  R_ERR response for host-to-device non-data FIS, CRC
0x0013  2            0  R_ERR response for host-to-device non-data FIS, non-CRC

磁盘日志2

几次开机时的错误信息

file.jsp

复制代码
After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 b8 80 1c 96 40

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ec 00 01 00 00 00 00 80      00:00:22.000  IDENTIFY DEVICE
  ec 00 01 00 00 00 00 80      00:00:18.800  IDENTIFY DEVICE
  ef 10 02 00 00 00 a0 80      00:00:18.500  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:18.500  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 80      00:00:18.500  SET FEATURES [Set transfer mode]

Error 7 occurred at disk power-on lifetime: 459 hours (19 days + 3 hours)
  When the command that caused the error occurred, the device was in an unknown state.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 a0 80 08 00 40

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ec 00 01 00 00 00 00 80      00:00:19.200  IDENTIFY DEVICE
  ef 10 02 00 00 00 a0 80      00:00:18.900  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:18.900  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 80      00:00:18.900  SET FEATURES [Set transfer mode]
  ef 10 02 00 00 00 a0 80      00:00:18.800  SET FEATURES [Enable SATA feature]

Error 6 occurred at disk power-on lifetime: 459 hours (19 days + 3 hours)
  When the command that caused the error occurred, the device was in an unknown state.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 80 70 16 81 40  Error: ABRT

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 10 02 00 00 00 a0 80      00:00:26.100  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:26.100  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 80      00:00:26.100  SET FEATURES [Set transfer mode]
  ef 10 02 00 00 00 a0 80      00:00:26.100  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:26.100  IDENTIFY DEVICE

Error 5 occurred at disk power-on lifetime: 459 hours (19 days + 3 hours)
  When the command that caused the error occurred, the device was in an unknown state.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 80 b0 2f 9b 40  Error: ABRT

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 10 02 00 00 00 a0 80      00:00:23.100  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:23.100  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 80      00:00:23.100  SET FEATURES [Set transfer mode]
  ef 10 02 00 00 00 a0 80      00:00:23.000  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:23.000  IDENTIFY DEVICE

smartctl 7.5 2025-04-30 r5714 [x86_64-linux-5.4.0-146-generic] (local build)
Copyright (C) 2002-25, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     CFast 3TE7
Serial Number:    YCA12103250350060
LU WWN Device Id: 5 000000 000000000
Firmware Version: S19C04B
User Capacity:    240,057,409,536 bytes [240 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic, zeroed
Device is:        Not in smartctl database 7.5/5706
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Sep  3 11:52:00 2026 CST
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: 		(   33) seconds.
Offline data collection
capabilities: 			 (0x7b) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					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: 	 (   2) minutes.
Conveyance self-test routine
recommended polling time: 	 (   2) minutes.
SCT capabilities: 	       (0x0039)	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
  5 Reallocated_Sector_Ct   0x0012   100   100   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0012   203   100   000    Old_age   Always       -       459
 12 Power_Cycle_Count       0x0012   248   000   000    Old_age   Always       -       6136
163 Unknown_Attribute       0x0012   039   000   000    Old_age   Always       -       39
165 Unknown_Attribute       0x0012   013   000   000    Old_age   Always       -       13
167 Unknown_Attribute       0x0012   006   000   000    Old_age   Always       -       6
169 Unknown_Attribute       0x0000   100   100   000    Old_age   Offline      -       100
170 Unknown_Attribute       0x0013   100   100   001    Pre-fail  Always       -       221
171 Unknown_Attribute       0x0012   000   100   000    Old_age   Always       -       0
172 Unknown_Attribute       0x0012   000   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0012   157   000   000    Old_age   Always       -       5021
194 Temperature_Celsius     0x0002   044   100   000    Old_age   Always       -       44 (3 108 0 131 0)
229 Unknown_Attribute       0x0000   100   100   000    Old_age   Offline      -       125854144806040
235 Unknown_Attribute       0x0002   000   000   000    Old_age   Always       -       0
241 Total_LBAs_Written      0x0012   100   100   000    Old_age   Always       -       30054
242 Total_LBAs_Read         0x0012   100   100   000    Old_age   Always       -       81340

SMART Error Log Version: 1
ATA Error Count: 8 (device log contains only the most recent five errors)
	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 8 occurred at disk power-on lifetime: 459 hours (19 days + 3 hours)
  When the command that caused the error occurred, the device was in an unknown state.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 b8 80 1c 96 40

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ec 00 01 00 00 00 00 80      00:00:22.000  IDENTIFY DEVICE
  ec 00 01 00 00 00 00 80      00:00:18.800  IDENTIFY DEVICE
  ef 10 02 00 00 00 a0 80      00:00:18.500  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:18.500  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 80      00:00:18.500  SET FEATURES [Set transfer mode]

Error 7 occurred at disk power-on lifetime: 459 hours (19 days + 3 hours)
  When the command that caused the error occurred, the device was in an unknown state.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 a0 80 08 00 40

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ec 00 01 00 00 00 00 80      00:00:19.200  IDENTIFY DEVICE
  ef 10 02 00 00 00 a0 80      00:00:18.900  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:18.900  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 80      00:00:18.900  SET FEATURES [Set transfer mode]
  ef 10 02 00 00 00 a0 80      00:00:18.800  SET FEATURES [Enable SATA feature]

Error 6 occurred at disk power-on lifetime: 459 hours (19 days + 3 hours)
  When the command that caused the error occurred, the device was in an unknown state.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 80 70 16 81 40  Error: ABRT

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 10 02 00 00 00 a0 80      00:00:26.100  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:26.100  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 80      00:00:26.100  SET FEATURES [Set transfer mode]
  ef 10 02 00 00 00 a0 80      00:00:26.100  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:26.100  IDENTIFY DEVICE

Error 5 occurred at disk power-on lifetime: 459 hours (19 days + 3 hours)
  When the command that caused the error occurred, the device was in an unknown state.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 80 b0 2f 9b 40  Error: ABRT

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 10 02 00 00 00 a0 80      00:00:23.100  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:23.100  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 80      00:00:23.100  SET FEATURES [Set transfer mode]
  ef 10 02 00 00 00 a0 80      00:00:23.000  SET FEATURES [Enable SATA feature]
  ec 00 00 00 00 00 a0 80      00:00:23.000  IDENTIFY DEVICE

Error 4 occurred at disk power-on lifetime: 411 hours (17 days + 3 hours)
  When the command that caused the error occurred, the device was in an unknown state.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 90 60 97 35 40  Error: ABRT

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 00 00 00 00 a0 80      00:08:59.700  SET FEATURES [Enable write cache]
  ef 02 00 00 00 00 a0 80      00:08:59.700  SET FEATURES [Enable write cache]
  ef 02 00 00 00 00 a0 ff      00:08:59.600  SET FEATURES [Enable write cache]
  ef 02 00 00 00 00 a0 80      00:08:59.100  SET FEATURES [Enable write cache]
  ef 02 00 00 00 00 a0 80      00:08:59.100  SET FEATURES [Enable write cache]

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

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.

The above only provides legacy SMART information - try 'smartctl -x' for more

盘信息对比

项目 客户 自有
设备型号 CFast 3TE7 CFast 3TE7
序列号 YCA12506050350455 YCA12103250350060
LU WWN Device Id 5 24693e 003221657 5 000000 000000000(未分配/全零)
固件版本 S24306 S19C04B
用户容量 240,057,409,536 字节 240 GB 240,057,409,536 字节 240 GB
扇区大小 512 字节 逻辑/物理 512 字节 逻辑/物理
ATA 版本 ACS-3(未标明次版本) ACS-2(未标明次版本)
SATA 版本 SATA 3.2, 6.0 Gb/s(当前 6.0 Gb/s) SATA 3.2, 6.0 Gb/s(当前 6.0 Gb/s)
SCT 能力 0x0031:Status / Feature Control / Data Table 0x0039:Status / Error Recovery Control / Feature Control / Data Table
0x000a 4 3 Device-to-host register FISes sent due to a COMRESET 4(难道异常环境会多一次复位) 3

SATA链路复位

进入系统后的

复制代码
# 找到目标磁盘对应的 host 编号
ls -l /sys/block/sdX | grep -o 'host[0-9]*'

# 向该 host 的 scan 节点写入,触发重新扫描
echo "- - -" > /sys/class/scsi_host/host<N>/scan



 ls -l /sys/block/sda | grep -o 'host[0-9]*'
host5


echo "- - -" >/sys/class/scsi_host/host5/scan



下面也可以,只是不能用做系统盘。导致系统处于不稳定状态了。

echo "0000:00:17.0" > /sys/bus/pci/drivers/ahci/unbind
echo "0000:00:17.0" > /sys/bus/pci/drivers/ahci/bind

ubuntu initrd重新制作

复制代码
lsinitramfs /boot/initrd.img-5.4.0-150-generic |grep local
scripts/local
scripts/local-bottom
scripts/local-bottom/ntfs_3g
scripts/local-bottom/ORDER
scripts/local-premount
scripts/local-premount/fixrtc
scripts/local-premount/ntfs_3g
scripts/local-premount/ORDER
scripts/local-premount/resume

解压:

复制代码
 使用 unmkinitramfs 提取
 unmkinitramfs /boot/initrd.img-5.4.0-150-generic /tmp/initrd_extract
 cd initrd_extract/
 ls
early  main
find ./ -name local
./main/scripts/local

实际使用的,修改后重新打包即可

复制代码
sudo cp /usr/share/initramfs-tools/scripts/local /usr/share/initramfs-tools/scripts/local.bak

sudo cp local  /usr/share/initramfs-tools/scripts/local  (实际 initrd中使用此目录中的文件)

update-initramfs -u -k 5.4.0-150-generic

加载文件系统的流程

上面的local脚本即 挂载文件系统

复制代码
[    6.101610] ata6: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    6.108756] ata3: SATA link down (SStatus 0 SControl 300)
[    6.115183] ata1: SATA link down (SStatus 0 SControl 300)
[    6.121529] ata5: SATA link down (SStatus 0 SControl 300)
[    6.127909] ata2: SATA link down (SStatus 0 SControl 300)
[    6.134257] ata4: SATA link down (SStatus 0 SControl 300)
[    6.140704] ata6.00: ATA-9: CFast 3TE7, S19C04B, max UDMA/133
[    6.147283] ata6.00: 468862128 sectors, multi 16: LBA48 NCQ (depth 32), AA
[    6.155411] ata6.00: configured for UDMA/133
[    6.160660] scsi 5:0:0:0: Direct-Access     ATA      CFast 3TE7       04B  PQ: 0 ANSI: 5
[    6.169843] sd 5:0:0:0: Attached scsi generic sg0 type 0
[    6.169845] sd 5:0:0:0: [sda] 468862128 512-byte logical blocks: (240 GB/224 GiB)
[    6.184393] sd 5:0:0:0: [sda] Write Protect is off
[    6.190094] sd 5:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    6.195997] sd 5:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.223935]  sda: sda1 sda2
[    6.245652] sd 5:0:0:0: [sda] Attached SCSI disk
在磁盘驱动后,这里开始运行了local脚本
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
[DEBUG initramfs ] local_device_setup called: dev_id='UUID=e467d65a-75a0-43f0-be5b-f1572de6293f', name='root file system', ROOTDELAY='0'
[DEBUG initramfs] Starting wait-for-root for 'UU[    6.326067] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
ID=e467d65a-75a0-43f0-be5b-f1572de6293f' with timeout 30s...
[DEBUG initramfs] wait-for-root finished. Ret=0, FSTYPE='ext4'.
[DEBUG initramfs] wait-for-root time: start=4.59 47.69, end=4.59 47.69
Begin: Will now check root file system ... fsck from util-linux 2.31.1
[/sbin/fsck.ext4 (1) -- /dev/sda2] fsck.ext4 -a -C0 /dev/sda2 

磁盘丢失

假设启动过程中磁盘完全找不到是种什么情况呢? 我们在加载完毕内核,内核启动的过程中,将系统盘拔出,其运行的日志如下:

即在local脚本中默认30秒的等待在这里可以明显感受到,假设计时的话,这个停顿肯定是30s了。而后进入紧急模式。

复制代码
[    6.078800] ata4: SATA link down (SStatus 0 SControl 300)
[    6.085161] ata2: SATA link down (SStatus 0 SControl 300)
[    6.091781] ata3: SATA link down (SStatus 0 SControl 300)
[    6.098077] ata6: SATA link down (SStatus 0 SControl 300)
[    6.104679] ata1: SATA link down (SStatus 0 SControl 300)
[    6.111347] ata5: SATA link down (SStatus 0 SControl 300)
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
[DEBUG initramfs ] local_device_setup called: dev_id='UUID=e467d65a-75a0-43f0-be5b-f1572de6293f', name='root file system', ROOTDELAY='0'
[DEBUG initramfs] Starting wait-for-root for 'UUID=e467d65a-75a0-43f0-be5b-f1572de6293f' with timeout 30s...   这里明显会有停顿时间。
[DEBUG initramfs] wait-for-root finished. Ret=1, FSTYPE=''.
[DEBUG initramfs] wait-for-root time: start=4.42 45.68, end=34.42 391.76
Begin: Waiting for root file system ... Begin: Running /scripts/local-block ... done.
done.
Gave up waiting for root file system device.  Common problems:
 - Boot args (cat /proc/cmdline)
   - Check rootdelay= (did the system wait long enough?)
 - Missing modules (cat /proc/modules; ls /dev)
ALERT!  UUID=e467d65a-75a0-43f0-be5b-f1572de6293f does not exist.  Dropping to a shell!


BusyBox v1.27.2 (Ubuntu 1:1.27.2-2ubuntu3.2) built-in shell (ash)
Enter 'help' for a list of built-in commands.

(initramfs) 进入紧急模式

电源管理

磁盘电源管理

复制代码
# hdparm -C /dev/sda

/dev/sda:
 drive state is:  active/idle   正常
# hdparm -y /dev/sda

/dev/sda:
 issuing standby command     
# hdparm -C /dev/sda

/dev/sda:
 drive state is:  standby   状态变化

# hdparm -Y /dev/sda

/dev/sda:
 issuing sleep command
# hdparm -C /dev/sda

/dev/sda:
 drive state is:  standby   

加载报错日志

总结

对于这种偶发启动异常,通常有各种怀疑的点。比如梳理软件启动流程以期分析出可能的异常点;或者期望从磁盘日志等分析出更多信息。然而这些都是常规套路,体现不出来经验的价值。此问题的解决得益于丰富的SATA经验。而那些分析的流程仅仅看似有用。

相关推荐
ACP广源盛139246256731 个月前
高密度多盘存储扩展方案选型笔记|PCIe 转 SATA 桥接芯片 YLB3118@ACP 评估
硬件架构·硬件工程·国产芯片·sata
黑猫学长呀6 个月前
存储宝典第3篇:存储芯片中test mode是什么意思?
ssd·nvme·pcie·ufs·emmc·存储芯片·sata