USB HDD 出現故障時,dmesg 中消息的正常順序是什麼?
我有一個連接到 Debian GNU/Linux 伺服器的 USB 硬碟。我正在嘗試使用以下命令對其進行格式化(NTFS):
# mkntfs -v /dev/sdd1
這需要幾個小時,因為它也會檢查磁碟。檢查時,
dmesg -T
顯示以下內容:[Wed Jan 12 15:22:53 2022] sd 9:0:0:0: [sdd] Attached SCSI disk [Wed Jan 12 18:03:26 2022] usb 1-4: USB disconnect, device number 5 [Wed Jan 12 18:03:26 2022] blk_update_request: I/O error, dev sdd, sector 621745808 op 0x1:(WRITE) flags 0x104000 phys_seg 240 prio class 0 [Wed Jan 12 18:03:26 2022] Buffer I/O error on dev sdd1, logical block 621743760, lost async page write [Wed Jan 12 18:03:26 2022] Buffer I/O error on dev sdd1, logical block 621743761, lost async page write (...and so on for a few lines, then) [Wed Jan 12 18:03:26 2022] blk_update_request: I/O error, dev sdd, sector 621746048 op 0x1:(WRITE) flags 0x104000 phys_seg 240 prio class 0 [Wed Jan 12 18:03:26 2022] blk_update_request: I/O error, dev sdd, sector 621746288 op 0x1:(WRITE) flags 0x100000 phys_seg 8 prio class 0 [Wed Jan 12 18:03:26 2022] blk_update_request: I/O error, dev sdd, sector 621746296 op 0x1:(WRITE) flags 0x800 phys_seg 16 prio class 0 (...and so on for a few lines, then) [Wed Jan 12 18:03:31 2022] buffer_io_error: 9015384 callbacks suppressed (...other errors...)
看著大量的錯誤消息,我會說 HDD 幾乎死了,但將它附加到 Windows PC 似乎可以工作。此外
usb 1-4: USB disconnect, device number 5
,dmesg
在其他錯誤之前出現的第一個錯誤( .但是我在
dmesg
輸出方面不是很有經驗,所以很可能我讀錯了。編輯:根據 NiKiZe 的要求,這裡是輸出
smartctl -a /dev/sdd
:# smartctl -a /dev/sdd smartctl 6.6 2017-11-05 r4594 [x86_64-linux-5.10.0-3-amd64] (local build) Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Family: Western Digital Blue Mobile Device Model: WDC WD10SPCX-00KHST0 Serial Number: WD-WXF1A95F0J3X LU WWN Device Id: 5 0014ee 65b7e0332 Firmware Version: 01.01A01 User Capacity: 1.000.204.886.016 bytes [1,00 TB] Sector Sizes: 512 bytes logical, 4096 bytes physical Rotation Rate: 5400 rpm Device is: In smartctl database [for details use: -P show] ATA Version is: ACS-2 (minor revision not indicated) SATA Version is: SATA 3.0, 6.0 Gb/s (current: 1.5 Gb/s) Local Time is: Thu Jan 13 11:04:19 2022 CET SMART support is: Available - device has SMART capability. SMART support is: Enabled === START OF READ SMART DATA SECTION === SMART Status not supported: Incomplete response, ATA output registers missing SMART overall-health self-assessment test result: PASSED Warning: This result is based on an Attribute check. 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: (16080) 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: ( 184) minutes. Conveyance self-test routine recommended polling time: ( 5) minutes. SCT capabilities: (0x7035) 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 1 Raw_Read_Error_Rate 0x002f 200 200 051 Pre-fail Always - 0 3 Spin_Up_Time 0x0027 190 184 021 Pre-fail Always - 1500 4 Start_Stop_Count 0x0032 081 081 000 Old_age Always - 19048 5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0 7 Seek_Error_Rate 0x002e 200 200 000 Old_age Always - 0 9 Power_On_Hours 0x0032 073 073 000 Old_age Always - 20415 10 Spin_Retry_Count 0x0032 100 100 000 Old_age Always - 0 11 Calibration_Retry_Count 0x0032 100 100 000 Old_age Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 188 192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 43 193 Load_Cycle_Count 0x0032 187 187 000 Old_age Always - 41054 194 Temperature_Celsius 0x0022 119 095 000 Old_age Always - 28 196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0 197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0030 100 253 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0 200 Multi_Zone_Error_Rate 0x0008 100 253 000 Old_age Offline - 0 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.
假設這個 HDD 確實出現故障並且其中的錯誤消息
dmesg
是針對真正的壞扇區的,為什麼在壞扇區消息之前而不是之後dmesg
顯示斷開連接?
斷開連接首先發生,然後您會得到由斷開連接引起的混合錯誤,其中生成磁碟寫入的各個層會注意到有問題。
大多數 I/O 以具有磁碟支持的“臟”記憶體頁面的形式發生,核心最終會在寫入被應用程序確認很久之後刷新到磁碟,並且唯一的驅動程序層是仍然對請求感興趣的是記憶體子系統(想知道是否可以釋放頁面)和文件系統(需要在寫入數據後生成更多寫入以更新元數據)——上面的任何內容都已拆除已經。
一些請求不通過記憶體子系統(例如 SMART 狀態查詢),一些請求(如讀取)可能只附加到記憶體子系統,因為文件系統已經查找了塊映射並且不再需要涉及。
因此,由於斷開連接而收到的錯誤消息沒有特定的順序——它們發生在由於設備離線而生成、送出和拒絕請求時。如果某些請求之間存在因果關係(例如在中止數據傳輸後反映新狀態的日誌條目——畢竟,日誌可能在不同的設備上),那麼這就定義了一些順序。
我可能會嘗試在適當的 SATA 埠上使用磁碟,並通過良好的電源供電——USB 到 SATA 機箱中的電壓轉換器通常有點狡猾。