檔案系統突然變成唯讀;如何調試這個?

檔案系統突然變成唯讀;如何調試這個?

我的 ext-4 根檔案系統和主檔案系統突然變成唯讀的。我怎麼才能查出這是什麼原因?

系統是帶有systemd的ubuntu 16.04(安裝在ssd上),其中root和home分割區使用dm-crypt加密並使用ext-4 fs格式化。

編輯就在我寫完這篇文章後,系統再次崩潰(兩次),黑色/彩色螢幕略微閃爍。現在它似乎又起作用了。

包含/etc/fstab根分割區的掛載選項errors=remount-ro

smartctl -a /dev/sda給予

smartctl -a /dev/sda
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-21-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     SAMSUNG MZ7PC256HAFU-000L7
Serial Number:    S0Y5NSAC602442
Firmware Version: CXM72L1Q
User Capacity:    256,060,514,304 bytes [256 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS T13/1699-D revision 4c
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Mon May 23 17:07:40 2016 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:  (0x02) Offline data collection activity
                    was completed without error.
                    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:        ( 1020) 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:    (  17) minutes.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  9 Power_On_Hours          0x0032   098   098   000    Old_age   Always       -       6093
 12 Power_Cycle_Count       0x0032   097   097   000    Old_age   Always       -       2810
175 Program_Fail_Count_Chip 0x0032   100   100   010    Old_age   Always       -       0
176 Erase_Fail_Count_Chip   0x0032   100   100   010    Old_age   Always       -       0
177 Wear_Leveling_Count     0x0013   095   095   017    Pre-fail  Always       -       169
178 Used_Rsvd_Blk_Cnt_Chip  0x0013   094   094   010    Pre-fail  Always       -       230
179 Used_Rsvd_Blk_Cnt_Tot   0x0013   094   094   010    Pre-fail  Always       -       450
180 Unused_Rsvd_Blk_Cnt_Tot 0x0013   094   094   010    Pre-fail  Always       -       7614
181 Program_Fail_Cnt_Total  0x0032   100   100   010    Old_age   Always       -       0
182 Erase_Fail_Count_Total  0x0032   100   100   010    Old_age   Always       -       0
183 Runtime_Bad_Block       0x0013   100   100   010    Pre-fail  Always       -       0
184 End-to-End_Error        0x0033   100   100   097    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0032   066   042   000    Old_age   Always       -       34
195 Hardware_ECC_Recovered  0x001a   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   253   253   000    Old_age   Always       -       1
233 Media_Wearout_Indicator 0x003a   200   200   000    Old_age   Always       -       0
234 Unknown_Attribute       0x0012   100   100   000    Old_age   Always       -       0
235 Unknown_Attribute       0x0012   099   099   000    Old_age   Always       -       48
236 Unknown_Attribute       0x0012   099   099   000    Old_age   Always       -       48
237 Unknown_Attribute       0x0012   099   099   000    Old_age   Always       -       169
238 Unknown_Attribute       0x0012   099   099   000    Old_age   Always       -       450

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  Extended offline    Completed without error       00%      6092         -

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 系統未完全卸載分割區,則它們會將分割區掛載為唯讀,並且系統認為fsck在正常使用之前應在其上執行適當的版本。

檢查您的日誌或 dmesg 以了解是否屬於這種情況

答案2

正如之前的評論所建議的,開始你的“調試”訊息而不是挖掘 SMART 數據。您很可能會在那裡找到線索(SATA/SAS/SCSI/無論您使用什麼匯流排錯誤或讀取/寫入錯誤)。它還會告訴您哪個設備/分區有問題。

如前所述,該問題可能是「軟」問題,例如未完全卸載的檔案系統(例如由於電源故障),也可能是硬體問題,例如硬碟/SSD 損壞或故障。訊息在這兩種情況下都會顯示線索。

相關內容