FSCK to try to fix HD errors

My PC is showing symptoms of HD errors.
It’s with inexplicable legend.
How do I use FSCK to try to fix HD errors?

Withou knowing what filesystem is in use this question is hard to answer.

However

> man fsck
> man smartctl

might give some helpful information.

Regards

susejunky

Those tools, general know as fsck, are to repair errors with the structure of file systems. They can do nothing about errors in the hardware.

My file system ext4
/dev/sda
/dev/sda2 boot/efi dos32
/dev/sda3 swap
/dev/sda4 / ext4
/dev/sda6 /home ext4

We can only guess at what the “inexplicable legend” may have been… perhaps you could elaborate.

Run:

sudo /usr/sbin/smartctl -a /dev/sda

to see if you have any indications of a hardware problem before trying to (possibly) repair any file system…

sergio@localhost:~> sudo /usr/sbin/smartctl -a /dev/sda
[sudo] senha para root: 
smartctl 7.0 2019-05-21 r4917 [x86_64-linux-5.3.18-lp152.57-default] (SUSE RPM)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Toshiba 2.5" HDD MQ01ABF...
Device Model:     TOSHIBA MQ01ABF050
Serial Number:    665ACJJ5T
LU WWN Device Id: 5 000039 713781c62
Firmware Version: AM0P2A
User Capacity:    500.107.862.016 bytes [500 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sat Dec 12 11:30:47 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:      ( 112) The previous self-test completed having
                                        the read element of the test failed.
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:        ( 118) 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       -       1340
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       1528
  5 Reallocated_Sector_Ct   0x0033   100   100   050    Pre-fail  Always       -       80
  7 Seek_Error_Rate         0x000b   100   100   050    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0005   100   100   050    Pre-fail  Offline      -       0
  9 Power_On_Hours          0x0032   054   054   000    Old_age   Always       -       18656
 10 Spin_Retry_Count        0x0033   130   100   030    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       1528
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       25692
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       193
193 Load_Cycle_Count        0x0032   053   053   000    Old_age   Always       -       470358
194 Temperature_Celsius     0x0022   100   100   000    Old_age   Always       -       38 (Min/Max 14/58)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       7
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       10104
198 Offline_Uncorrectable   0x0030   100   001   000    Old_age   Offline      -       127
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
220 Disk_Shift              0x0002   100   100   000    Old_age   Always       -       0
222 Loaded_Hours            0x0032   056   056   000    Old_age   Always       -       17819
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       -       254
240 Head_Flying_Hours       0x0001   100   100   001    Pre-fail  Offline      -       0

SMART Error Log Version: 1
ATA Error Count: 2362 (device log contains only the most recent five errors)
        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 2362 occurred at disk power-on lifetime: 18651 hours (777 days + 3 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
  -- -- -- -- -- -- --
  40 41 48 d8 29 1d 40  Error: WP at LBA = 0x001d29d8 = 1911256

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  61 60 50 88 33 48 40 00      02:23:19.525  WRITE FPDMA QUEUED
  60 08 08 a8 9c 09 40 00      02:23:18.117  READ FPDMA QUEUED
  60 08 48 d8 29 1d 40 00      02:23:17.779  READ FPDMA QUEUED
  60 40 40 c0 64 04 40 00      02:23:17.767  READ FPDMA QUEUED
  60 40 38 00 08 08 40 00      02:23:17.767  READ FPDMA QUEUED

Error 2361 occurred at disk power-on lifetime: 18651 hours (777 days + 3 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
  -- -- -- -- -- -- --
  40 41 60 68 cc 2c 40  Error: UNC at LBA = 0x002ccc68 = 2935912

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 08 60 68 cc 2c 40 00      02:23:14.196  READ FPDMA QUEUED
  60 08 58 b8 24 9c 40 00      02:23:14.196  READ FPDMA QUEUED
  60 08 50 a8 8c 09 40 00      02:23:14.196  READ FPDMA QUEUED
  61 08 48 80 33 48 40 00      02:23:14.196  WRITE FPDMA QUEUED
  ea 00 00 00 00 00 a0 00      02:23:14.188  FLUSH CACHE EXT

Error 2360 occurred at disk power-on lifetime: 18651 hours (777 days + 3 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
  -- -- -- -- -- -- --
  40 41 00 68 cc 2c 40  Error: WP at LBA = 0x002ccc68 = 2935912

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  61 c0 18 c0 32 48 40 00      02:23:13.137  WRITE FPDMA QUEUED
  61 08 10 28 09 a1 40 00      02:23:13.136  WRITE FPDMA QUEUED
  60 08 08 b8 24 9c 40 00      02:23:11.841  READ FPDMA QUEUED
  60 08 f8 a8 8c 09 40 00      02:23:10.838  READ FPDMA QUEUED
  60 08 00 68 cc 2c 40 00      02:23:10.729  READ FPDMA QUEUED

Error 2359 occurred at disk power-on lifetime: 18651 hours (777 days + 3 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
  -- -- -- -- -- -- --
  40 41 e0 d8 29 1d 40  Error: UNC at LBA = 0x001d29d8 = 1911256

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 08 e0 d8 29 1d 40 00      02:21:17.005  READ FPDMA QUEUED
  60 80 d8 20 48 24 40 00      02:21:17.005  READ FPDMA QUEUED
  60 00 d0 a0 48 24 40 00      02:21:17.005  READ FPDMA QUEUED
  60 18 c8 60 ef 19 40 00      02:21:17.005  READ FPDMA QUEUED
  60 18 c0 f8 a3 24 40 00      02:21:17.005  READ FPDMA QUEUED

Error 2358 occurred at disk power-on lifetime: 18651 hours (777 days + 3 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
  -- -- -- -- -- -- --
  40 41 f0 d8 29 1d 40  Error: WP at LBA = 0x001d29d8 = 1911256

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  61 18 00 d8 11 48 40 00      02:21:15.885  WRITE FPDMA QUEUED
  60 10 f8 e0 bb 40 40 00      02:21:13.662  READ FPDMA QUEUED
  60 18 80 60 ef 19 40 00      02:21:13.575  READ FPDMA QUEUED
  60 00 78 a0 48 24 40 00      02:21:13.562  READ FPDMA QUEUED
  60 80 70 20 48 24 40 00      02:21:13.562  READ FPDMA QUEUED

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed: read failure       00%     18649         245742240
# 2  Short offline       Completed: read failure       00%     18645         245742240
# 3  Short offline       Completed without error       00%     18624         -
# 4  Short offline       Completed without error       00%     18609         -
# 5  Short offline       Completed without error       00%     18595         -
# 6  Short offline       Completed without error       00%     18576         -
# 7  Extended offline    Completed: read failure       00%     18556         92107184
# 8  Short offline       Completed without error       00%     18536         -
# 9  Short offline       Completed: read failure       00%     18520         92107184
#10  Short offline       Completed: read failure       00%     18505         92107184
#11  Short offline       Completed without error       00%     18486         -
#12  Short offline       Completed without error       00%     18470         -
#13  Short offline       Completed: read failure       00%     18456         412593848
#14  Short offline       Completed: read failure       00%     18439         412593848
#15  Short offline       Completed without error       00%     18429         -
#16  Short offline       Completed without error       00%     18413         -
#17  Short offline       Completed without error       00%     18393         -
#18  Short offline       Completed without error       00%     18376         -
#19  Short offline       Completed without error       00%     18359         -
#20  Short offline       Completed without error       00%     18339         -
#21  Short offline       Completed without error       00%     18322         -

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.

sergio@localhost:~> 

To find a bad spot on a disk it will give errors on any bad sectors change sdX to the drive you want to see. If no errors then the drive has no bad spots or had mapped the bad to a spare track.

dd if=/dev/sdX of=/dev/null status=progress

You cannot fsck a mounted drive - you have to boot a live CD or USB to run fsck on any normally mounted drive.

The whole idea of using fsck on a disk with bad spots is pointless.

Looking at the smartctrl output for that drive…

I’d back up any important data whilst you can and think about replacing the drive.

If you want to pursue attempting to reallocate bad blocks, of which it looks as if there are many, then this article may assist:

https://www.smartmontools.org/wiki/BadBlockHowto