我必須經常使用“fsck”來修復我的電腦

我必須經常使用“fsck”來修復我的電腦

這不是我第一次犯這樣的錯。當我的文件權限變成 時read-only,我正在使用我的計算機(Ubuntu 3.2),所以我重新啟動了計算機,它沒有完成打開,所以我強制關閉它(硬關閉),然後我再次打開它,我看到了這個:

/dev/sda2 contains a file system with errors, check forced.
Inodes that were part of a corrupted orphan linked list found.

/dev/sda2: UNEXPECTED INCOSISTENCY; RUN fsck MANUALLY.
          (i.e., without -a or -p options)
fsck exited with status code 4
The root filesystem on /dev/sda2 requires a manual fsck


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) 

我寫了fsck /dev/sda2-a因為我不知道如果沒有它該怎麼做),我很擔心,因為這不是第一次,也許硬碟壞了或我不知道。也許這不是解決我的問題的最佳位置。你能告訴我該怎麼做嗎?接下來是什麼?我想學習,所以你的建議太有幫助了。

PD:對不起我的英語

我寫了fsck /dev/sda2,接下來是:

fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
/dev/sda2 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were of a corrupted orphan linked list found. Fix<y>?

我把y螢幕印出來:

Inode 18874440 was part of the orphaned inode list. FIXED
Inode 18874445 was part of the orphaned inode list. FIXED
Inode 18874466 was part of the orphaned inode list. FIXED

其中 20 行,以下是

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(2494976--2495023) - (so many numbers)....
Fix<y>? yes
Free blocks count wrong for group #76 (19099, counted 19147).
Fix<y>? yes
Free blocks count wrong for group #81 (30339, counted=30365)
Fix<y>? yes
Free blocks count wrong for group #1577 (28430, counted=28437)
Fix<y>? yes
...

最後

/dev/sda2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda2: 541701/61022208 files (0.4% non-contiguous),  18674207/244059136 blocks

寫完之後,reboot電腦就恢復工作了。但這種事還會再發生,我需要阻止它。

我需要一些書來調查這個問題,我想了解為什麼會發生這種情況。


更新: 再次發生這種情況,當我使用 Mozilla Firefox 時,檔案的權限變成了read only.然後我重新啟動電腦,但它沒有完成。我將不得不重新啟動它並fsck再次使用。


輸出sudo smartctl -a /dev/sda

smartctl 6.6 2016-05-31 r4324 [x86_64-linux-5.3.0-42-generic] (local build) 
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org 

=== START OF INFORMATION SECTION === 
Device Model:     TOSHIBA MQ04ABF100 
Serial Number:    X8JBP3K2T 
LU WWN Device Id: 5 000039 8d268714d 
Firmware Version: JU001J 
User Capacity:    1.000.204.886.016 bytes [1,00 TB] 
Sector Sizes:     512 bytes logical, 4096 bytes physical 
Rotation Rate:    5400 rpm 
Form Factor:      2.5 inches 
Device is:        Not in smartctl database [for details use: -P showall] 
ATA Version is:   ACS-3 T13/2161-D revision 5 
SATA Version is:  SATA >3.2 (0x1ff), 6.0 Gb/s (current: 6.0 Gb/s) 
Local Time is:    Sun Mar 29 03:48:34 2020 -03 
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:        (  120) 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:    ( 172) 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   050    Pre-fail  Always       -       0 
  2 Throughput_Performance  0x0005   100   100   050    Pre-fail  Offline      -       0 
  3 Spin_Up_Time            0x0027   100   100   001    Pre-fail  Always       -       1348 
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       596 
  5 Reallocated_Sector_Ct   0x0033   100   100   050    Pre-fail  Always       -       0 
  7 Seek_Error_Rate         0x000b   100   095   050    Pre-fail  Always       -       0 
  8 Seek_Time_Performance   0x0005   100   100   050    Pre-fail  Offline      -       0 
  9 Power_On_Hours          0x0032   097   097   000    Old_age   Always       -       1544 
 10 Spin_Retry_Count        0x0033   111   100   030    Pre-fail  Always       -       0 
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       421 
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       1265 
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       20 
193 Load_Cycle_Count        0x0032   096   096   000    Old_age   Always       -       48581 
194 Temperature_Celsius     0x0022   100   100   000    Old_age   Always       -       35 (Min/Max 13/45) 
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0 
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       0 
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0 
199 UDMA_CRC_Error_Count    0x0032   200   253   000    Old_age   Always       -       0 
220 Disk_Shift              0x0002   100   100   000    Old_age   Always       -       0 
222 Loaded_Hours            0x0032   097   097   000    Old_age   Always       -       1346 
223 Load_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0 
224 Load_Friction           0x0022   100   100   000    Old_age   Always       -       0 
226 Load-in_Time            0x0026   100   100   000    Old_age   Always       -       260 
240 Head_Flying_Hours       0x0001   100   100   001    Pre-fail  Offline      -       0 

SMART Error Log Version: 1 
ATA Error Count: 1 
    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 1 occurred at disk power-on lifetime: 1096 hours (45 days + 16 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 
  -- -- -- -- -- -- -- 
  04 31 00 02 59 d7 a9 

  Commands leading to the command that caused the error were: 
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name 
  -- -- -- -- -- -- -- --  ----------------  -------------------- 
  ea 00 00 00 00 00 a0 00      05:01:42.830  FLUSH CACHE EXT 
  61 58 30 38 f9 20 40 00      05:01:42.830  WRITE FPDMA QUEUED 
  61 08 80 08 f9 1b 40 00      05:01:42.829  WRITE FPDMA QUEUED 
  61 08 78 a0 b8 52 40 00      05:01:42.788  WRITE FPDMA QUEUED 
  61 30 70 58 0c 50 40 00      05:01:42.788  WRITE FPDMA QUEUED 

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. 

答案1

我的建議:立即備份數據,然後儘快更換驅動器。幾年前,我在一台運行 Linux 的舊 Macbook 上遇到了類似的問題。根檔案系統會突然變為唯讀,並且在重新啟動時我必須fsck每次都運行來修復它。smartmontools表明一切都很好。我更換了硬碟,問題立刻消失。

我並不是說您的問題一定是相同的,但聽起來與我的經歷非常相似。作為預防措施,至少要備份您的資料。

答案2

同樣的問題也發生在我身上,我的 Ubuntu 19.10 重新啟動時必須執行指令:

fsck -fy /dev/sda2

我開始分析日誌/var/log/syslog,並/var/log/kern.log意識到在損壞磁碟之前,與我的電池相關的資訊總是從laptop-mode-tools我前一天安裝的軟體中記錄的。

因此,我決定卸載此類軟體,就我而言,它不再給我帶來損壞磁碟的問題。

答案3

我有同樣的問題,我有雙啟動ubuntu 20.04視窗 10。每次啟動 ubuntu 時我都會遇到同樣的問題(fsck 有錯誤的分區)一段時間後我甚至無法登入 ubuntu 了。

但我可以登入視窗並通過分析(使用硬碟哨兵工具)在那裡我發現我的硬碟上有很多壞扇區(壞扇區意味著硬碟的物理損壞,據我所知無法恢復)。

我用 240 GB SSD 取代了 1 TB HDD,在新 SSD 上我只安裝了 ubuntu 21.04,問題就消失了。我係統的 HDD 已有 5 年以上的歷史,這就是大多數 HDD 的壽命(我也廣泛使用它,幾乎每天都使用它)。

重點:首先確保 HDD/SSD 運作狀況良好。

相關內容