文件系统突然变成只读;如何调试这个?

文件系统突然变成只读;如何调试这个?

我的 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 损坏或出现故障。消息在这两种情况下都会显示线索。

相关内容