I have been having hard drive issues on Ubuntu 18.04 where the system randomly remounts my root partition (/dev/sda4) as read-only due to errors.
dmesg|grep 'I/O error'
reveals obvious problems with sda4. I don't have the exact output right now as the box was successfully rebooted and is not having issues as of this moment.
My plan was to run a file system check on the file system. I followed this answer as well as this tutorial carefully. In the latter tutorial I used the section titled: "How to force fsck to check filesystem after system reboot on Linux when using systemd"
After reboot, however, the file system is NOT checked as revealed by the output of this command:
tune2fs -l /dev/sda4 | grep checked
Last checked: Sat Nov 21 15:36:56 2020
I have tried these variations of the GRUB CMDLINE but they have been unsuccessful:
GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity fsck.mode=force"
and
GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity fsck.mode=force fsck.repair=yes"
And yes, I did run update-grub
. What am I missing?
Output of smartctl -a /dev/sda
:
Device Model: Samsung SSD 860 EVO 250GB
Serial Number: S59WNG0MA22770K
LU WWN Device Id: 5 002538 e70265a2a
Firmware Version: RVT03B6Q
User Capacity: 250,059,350,016 bytes [250 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: Unknown(0x09fc), ACS-4 T13/BSR INCITS 529 revision 5
SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Wed May 3 11:35:14 2023 MST
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: ( 0) seconds.
Offline data collection
capabilities: (0x53) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
No 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: ( 85) 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: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0033 038 038 010 Pre-fail Always - 311
9 Power_On_Hours 0x0032 095 095 000 Old_age Always - 21420
12 Power_Cycle_Count 0x0032 099 099 000 Old_age Always - 14
177 Wear_Leveling_Count 0x0013 001 001 000 Pre-fail Always - 2041
179 Used_Rsvd_Blk_Cnt_Tot 0x0013 100 100 010 Pre-fail Always - 0
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 038 038 010 Pre-fail Always - 311
187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0032 067 065 000 Old_age Always - 33
195 Hardware_ECC_Recovered 0x001a 200 200 000 Old_age Always - 0
199 UDMA_CRC_Error_Count 0x003e 100 100 000 Old_age Always - 0
235 Unknown_Attribute 0x0012 099 099 000 Old_age Always - 10
241 Total_LBAs_Written 0x0032 099 099 000 Old_age Always - 166281511800
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
256 0 65535 Read_scanning was never started
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.
UPDATE:
The server crashed again this morning (it's still up but /
is mounted as read-only) and here is what I see in dmesg:
dmesg |grep sda
[70547.166349] sd 0:0:0:0: [sda] tag#13 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[70547.166354] sd 0:0:0:0: [sda] tag#13 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00
[70948.441912] sd 0:0:0:0: [sda] tag#15 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[70948.441918] sd 0:0:0:0: [sda] tag#15 CDB: Read(10) 28 00 1a cb 1c 00 00 00 08 00
[70948.441922] print_req_error: I/O error, dev sda, sector 449518592
[70948.442312] sd 0:0:0:0: [sda] tag#16 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[70948.442315] sd 0:0:0:0: [sda] tag#16 CDB: Read(10) 28 00 1a cb 1c 00 00 00 08 00
[70948.442316] print_req_error: I/O error, dev sda, sector 449518592
[70948.442955] sd 0:0:0:0: [sda] tag#17 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[70948.442960] sd 0:0:0:0: [sda] tag#17 CDB: Read(10) 28 00 0e 0b 03 08 00 00 20 00
[70948.442962] print_req_error: I/O error, dev sda, sector 235602696
[70948.443389] sd 0:0:0:0: [sda] tag#18 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[70948.443393] sd 0:0:0:0: [sda] tag#18 CDB: Read(10) 28 00 0e 0b 03 08 00 00 08 00
[70948.443396] print_req_error: I/O error, dev sda, sector 235602696
[72347.211525] sd 0:0:0:0: [sda] tag#19 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[72347.211531] sd 0:0:0:0: [sda] tag#19 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00
[74147.255746] sd 0:0:0:0: [sda] tag#21 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[74147.255752] sd 0:0:0:0: [sda] tag#21 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00
[75947.299631] sd 0:0:0:0: [sda] tag#23 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[75947.299637] sd 0:0:0:0: [sda] tag#23 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00
[77747.345291] sd 0:0:0:0: [sda] tag#25 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[77747.345297] sd 0:0:0:0: [sda] tag#25 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00
[79547.389376] sd 0:0:0:0: [sda] tag#27 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[79547.389382] sd 0:0:0:0: [sda] tag#27 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00
[81347.432593] sd 0:0:0:0: [sda] tag#29 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[81347.432598] sd 0:0:0:0: [sda] tag#29 CDB: ATA command pass through(16) 85 06 2c 00 00 00 00 00 00 00 00 00 00 00 e5 00
I do realize the drive needs to be replaced, but my goal is simply to run fsck
on the root partition.