2

I have two disks, at / and /home/ and both show errors with e2fsck -fn /dev/<disk>. (-f = check even if 'clean', -n = read-only mode)

How can I fix these file-system errors?

I managed to enable boot-time scanning (unsure if it scans both), but afterwards both disks still give errors.


Details

I followed the guide at https://linuxconfig.org/how-to-force-fsck-to-check-filesystem-after-system-reboot-on-linux and the method with the touch file didn't work even for the root disk. Ubuntu complains:

Feb 11 17:11:02 mark systemd-fsck[690]: Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system.

I tried the second option on both disks, editing /etc/fstab to set the result code to 2 and executing tune2fs -c 1 /dev/disk for both disks. Since the, during every boot I see:

Press Ctrl+C to cancel all filesystem checks in progress
Checking in progress on 1 disk (26.0% completed)

It shows 1 disk (I expected two). It starts at 26% and goes up to (almost) 100%.(it looked like that because the monitor was switching resolution)

After logging in, when I execute e2fsck on both disks, I still find multiple errors, like orphaned inodes, wrong free node count, zero dtime inodes, block bitmap differences, etc.

How can I fix the errors I find with e2fsck, during boot-time?


The errors:

mark@mark:~$ sudo e2fsck -nf /dev/sda5; sudo e2fsck -nf /dev/sdb1
e2fsck 1.44.1 (24-Mar-2018)
Warning!  /dev/sda5 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (51260638, counted=51258463).
Fix? no

Free inodes count wrong (13280655, counted=13280622).
Fix? no

/dev/sda5: 154225/13434880 files (0.1% non-contiguous), 2464034/53724672 blocks
e2fsck 1.44.1 (24-Mar-2018)
Warning!  /dev/sdb1 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found.  Fix? no

Inode 21235676 was part of the orphaned inode list.  IGNORED.
Inode 21236927 was part of the orphaned inode list.  IGNORED.
Inode 21237621 was part of the orphaned inode list.  IGNORED.
Inode 21237990 was part of the orphaned inode list.  IGNORED.
Inode 21238402 was part of the orphaned inode list.  IGNORED.
Inode 21238464 was part of the orphaned inode list.  IGNORED.
Deleted inode 21238506 has zero dtime.  Fix? no

Inode 21238523 was part of the orphaned inode list.  IGNORED.
Inode 21238553 was part of the orphaned inode list.  IGNORED.
Inode 35651957 was part of the orphaned inode list.  IGNORED.
Pass 2: Checking directory structure
Entry 'Ubuntu notes.txt' in /mark/Documents (21233680) has deleted/unused inode 21238530.  Clear? no

Entry 'desktop-metadata' in /mark/.config/nautilus (21233804) has deleted/unused inode 21238525.  Clear? no

Entry 'xulstore.json' in /mark/.thunderbird/rhccmynw.default (21495857) has deleted/unused inode 21498027.  Clear? no

Entry 'lock' in /mark/.thunderbird/rhccmynw.default (21495857) has deleted/unused inode 21497953.  Clear? no

Entry 'global-messages-db.sqlite-journal' in /mark/.thunderbird/rhccmynw.default (21495857) references inode 21498857 found in group 2624's unused inodes area.
Fix? no

Entry 'global-messages-db.sqlite-journal' in /mark/.thunderbird/rhccmynw.default (21495857) has deleted/unused inode 21498857.  Clear? no

Entry 'cba86d7c-56f1-4b53-9002-e6008d7ec077' in /mark/.thunderbird/rhccmynw.default/saved-telemetry-pings (21629137) has deleted/unused inode 21627358.  Clear? no

Entry 'recovery.baklz4' in /mark/.mozilla/firefox/1oxfnaca.default-1536326026399/sessionstore-backups (23592969) has deleted/unused inode 23594226.  Clear? no

Entry 'storage.js' in /mark/.mozilla/firefox/1oxfnaca.default-1536326026399/browser-extension-data/uBlock0@raymondhill.net (26869816) has deleted/unused inode 26869799.  Clear? no

Entry 'home-132a535f.log' in /mark/.local/share/gvfs-metadata (21233829) has deleted/unused inode 21238552.  Clear? no

Entry 'DEB72738C9A4BD2631567485A211516096512633' in /mark/.cache/thunderbird/rhccmynw.default/cache2/entries (21233899) has deleted/unused inode 21238528.  Clear? no

Entry 'E86D0879A15003F74582DAA01F04268E5E3A6193' in /mark/.cache/thunderbird/rhccmynw.default/cache2/entries (21233899) has deleted/unused inode 21238550.  Clear? no

Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Unattached inode 21238336
Connect to /lost+found? no

Unattached inode 21238501
Connect to /lost+found? no

Unattached zero-length inode 21498131.  Clear? no

Unattached inode 21498131
Connect to /lost+found? no

Unattached zero-length inode 23593885.  Clear? no

Unattached inode 23593885
Connect to /lost+found? no

Unattached zero-length inode 26869802.  Clear? no

Unattached inode 26869802
Connect to /lost+found? no

Pass 5: Checking group summary information
Block bitmap differences:  -(84968536--84968537) -(84968580--84968581) -84968797 +(84968918--84968919) -(84969152--84969154) +(84970738--84970739) -(84971372--84971374) -(84971940--84971961) -(84971993--84972003) +85247486 -(85288043--85288050) +(85288078--85288079) -(85418135--85418145) +(85418146--85418148) +85578637 -(85581356--85581366) -(85581436--85581437) -(85581454--85581470) -(85581486--85581490) -(85581862--85581873) -(85581875--85581885) +85582421 -85582422 -(85582435--85582436) -85582440 -(85582460--85582470) -(85582476--85582477) -(85587974--85587984) +(85588047--85588054) -85588058 -(85588061--85588088) -85588094 -(85689681--85689810) -(86016016--86016017) +(86016046--86016047) +86016126 +(86016205--86016207) -(86016244--86016247) +(86384640--86384647) +(86453944--86453945) +(86454004--86454008) -(86540452--86540454) -88113216 -(88836576--88836603) -(90732824--90732825) -(94589879--94589887) -(94590320--94590334) -(110201600--110201638) -(110209536--110209696) +(129848128--129848166) -(136747992--136749179) -(138456000--138456038) +(142697944--142697951) +(142697953--142697977) +(142701330--142701332)
Fix? no

Free blocks count wrong for group #2593 (20540, counted=20533).
Fix? no

Free blocks count wrong for group #2601 (27008, counted=27009).
Fix? no

Free blocks count wrong for group #2602 (30229, counted=30231).
Fix? no

Free blocks count wrong for group #2606 (17690, counted=17693).
Fix? no

Free blocks count wrong for group #2611 (18206, counted=18122).
Fix? no

Free blocks count wrong for group #2615 (18615, counted=18485).
Fix? no

Free blocks count wrong for group #2636 (26230, counted=26238).
Fix? no

Free blocks count wrong for group #2638 (19435, counted=19446).
Fix? no

Free blocks count wrong for group #2641 (29547, counted=29544).
Fix? no

Free blocks count wrong for group #2712 (18146, counted=18130).
Fix? no

Free blocks count wrong for group #2768 (15344, counted=15342).
Fix? no

Free blocks count wrong for group #2884 (974, counted=971).
Fix? no

Free blocks count wrong for group #2886 (6832, counted=6822).
Fix? no

Free blocks count wrong for group #3360 (22484, counted=21894).
Fix? no

Free blocks count wrong for group #3363 (3835, counted=3635).
Fix? no

Free blocks count wrong for group #3962 (5153, counted=5192).
Fix? no

Free blocks count wrong for group #4173 (26643, counted=25455).
Fix? no

Free blocks count wrong for group #4354 (25277, counted=25313).
Fix? no

Free blocks count wrong (189550061, counted=189547835).
Fix? no

Inode bitmap differences:  -21235676 -21236927 -21237621 -21237990 -21238402 -21238464 -21238506 -21238523 -21238525 -21238528 -21238530 -21238550 -(21238552--21238553) -21497953 -21498027 +21498131 -21498857 -21627358 +23593885 -23594226 -26869799 +26869802 -27918519 -27918526 -35651957
Fix? no

Free inodes count wrong for group #2592 (2527, counted=2522).
Fix? no

Free inodes count wrong for group #2624 (5146, counted=5144).
Fix? no

Free inodes count wrong for group #2640 (6403, counted=6402).
Fix? no

Free inodes count wrong for group #2880 (140, counted=139).
Fix? no

Free inodes count wrong for group #3408 (5367, counted=5365).
Fix? no

Free inodes count wrong (60153933, counted=60153866).
Fix? no


/dev/sdb1: ********** WARNING: Filesystem still has errors **********

/dev/sdb1: 901043/61054976 files (0.4% non-contiguous), 54639880/244189941 blocks

[edit] Added requested output of smartctl

mark@mark:~$ sudo smartctl --all /dev/sda5; sudo smartctl --all /dev/sdb1
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.18.0-15-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     KINGSTON SUV400S37240G
Serial Number:    50026B776B003933
LU WWN Device Id: 0 550380 440010000
Firmware Version: 0C3J96R9
User Capacity:    240,057,409,536 bytes [240 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    Solid State Device
Form Factor:      M.2
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   Unknown(0x0ffe), ATA8-ACS T13/1699-D revision 6
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Feb 28 11:30:37 2019 CET
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:        (    5) seconds.
Offline data collection
capabilities:            (0x71) SMART execute Offline immediate.
                    No Auto Offline data collection support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    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:    (   5) minutes.
Conveyance self-test routine
recommended polling time:    (   0) 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: 48
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   100   100   000    Pre-fail  Always       -       0
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       4502
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       496
100 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       915296
101 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       198848
170 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
171 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
172 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
174 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       9
175 Program_Fail_Count_Chip 0x0032   100   100   000    Old_age   Always       -       0
176 Erase_Fail_Count_Chip   0x0032   100   100   000    Old_age   Always       -       0
177 Wear_Leveling_Count     0x0032   100   100   000    Old_age   Always       -       269
178 Used_Rsvd_Blk_Cnt_Chip  0x0002   100   100   000    Old_age   Always       -       0
180 Unused_Rsvd_Blk_Cnt_Tot 0x0002   100   100   000    Old_age   Always       -       1194
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       4
187 Reported_Uncorrect      0x0033   100   100   000    Pre-fail  Always       -       0
194 Temperature_Celsius     0x0022   027   100   000    Old_age   Always       -       27 (Min/Max 20/35)
195 Hardware_ECC_Recovered  0x0032   100   100   000    Old_age   Always       -       0
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       0
199 UDMA_CRC_Error_Count    0x0012   100   100   000    Old_age   Always       -       0
201 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       0
204 Soft_ECC_Correction     0x0032   100   100   000    Old_age   Always       -       0
231 Temperature_Celsius     0x0032   100   100   000    Old_age   Always       -       0
233 Media_Wearout_Indicator 0x0032   100   100   000    Old_age   Always       -       1575
234 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       920
241 Total_LBAs_Written      0x0032   100   100   000    Old_age   Always       -       1374
242 Total_LBAs_Read         0x0032   100   100   000    Old_age   Always       -       1456
250 Read_Error_Retry_Rate   0x0032   100   100   000    Old_age   Always       -       0

SMART Error Log Version: 0
No Errors Logged

SMART Self-test log structure revision number 0
Warning: ATA Specification requires 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 0
Note: revision number not 1 implies that no selective self-test has ever been run
 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.

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

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Red
Device Model:     WDC WD10EFRX-68FYTN0
Serial Number:    WD-WCC4J4TC3CEE
LU WWN Device Id: 5 0014ee 2b8acbc22
Firmware Version: 82.00A82
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Feb 28 11:30:37 2019 CET
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:        (13500) seconds.
Offline data collection
capabilities:            (0x7b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    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:    ( 154) minutes.
Conveyance self-test routine
recommended polling time:    (   5) minutes.
SCT capabilities:          (0x303d) 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     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   137   136   021    Pre-fail  Always       -       4141
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       502
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   094   094   000    Old_age   Always       -       4497
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       502
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       11
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       564
194 Temperature_Celsius     0x0022   113   109   000    Old_age   Always       -       30
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   100   253   000    Old_age   Offline      -       0

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
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.
  • The simplest way to do this, use a live-disc. Just start it and then use e.g. gparted and do your tests. Otherwise you will need to make sure that the discs you would like to scan, are NOT mounted. this is most important. – s1mmel Feb 25 at 15:27
  • 1
    Run the full e2fsck from a live installer on all ext4 partitions: askubuntu.com/questions/642504/… – oldfred Feb 25 at 15:31
  • I got these when my hdd started dying, had to replace unfortunately...but with a nice new ssd :) – Sam Wheel Feb 26 at 9:32
  • possible duplicate of askubuntu.com/questions/1006417/… – kenn Feb 26 at 14:12
  • 1. why did you do -n? That will fix nothing... use -y instead 2. Please edit your question and provide the full output to sudo smartctl --all /dev/<disk> The threshold is normally 0 most of the time. We need the raw values... – Fabby Feb 26 at 22:02
0
+50

A mounted volume isn't "clean", this is absolutely normal. Only unmounted volumes (or volumes mounted read-only) are to be expected to be "clean". Most probably there isn't the slightest problem with your filesystems.

From the man page:

Note that in general it is not safe to run e2fsck on mounted filesystems. The only exception is if the -n option is specified, and -c, -l, or -L options are not specified. However, even if it is safe to do so, the results printed by e2fsck are not valid if the filesystem is mounted. If e2fsck asks whether or not you should check a filesystem which is mounted, the only correct answer is ``no''. Only experts who really know what they are doing should consider answering this question in any other way.

Check and fix your filesystem while booting from another medium (like a USB thumb drive). Checking the disks while they are mounted makes no sense at all and fsck output means nothing.

  • Unhelpful. I already read that, and use the -noption (see question). Also forcefsck is not supported anymore (again, see question). – Mark Jeronimus Feb 26 at 18:40
  • @MarkJeronimus you are checking your filesystems while mounted. Then they will always look "unclean" and fsck output is meaningless. That's the whole point. I've edited my answer to make this clearer. – wazoox Feb 26 at 18:51
  • Makes sense. I missed that part – Mark Jeronimus Mar 1 at 15:57
1

Easy:

  1. Download Ubuntu again,
  2. "burn" it to a USB / DVD / BlueRay
  3. open a terminal and run:

    fsck -vcf dev/<disk>
    

    and press "y" for every error you want to fix.

  4. Then locate bad blocks:

    badblocks -v /dev/<disk>
    

If all goes well, all errors should be gone. If they're not, run:

smartctl --all /dev/<disk>

and that will then show you that your disk might be dying.

  • With a live stick it fixed one problem on one disk and found nothing on the other. Then rebooted normally and both disks still give (roughly) the same errors as before with the exact same scan commands. N.b. I reinstalled Ubuntu yesterday from the same stick as I just used. ~~ smartctl shows -zero- at all values relating to errors, reallocation, ecc, retries, etc. – Mark Jeronimus Feb 26 at 13:25
  • See edits and comment below your question. You're not fixing anything; of course the errors remain. – Fabby Feb 26 at 22:05
  • Of course I entered 'a' when it found something. Afterwards it didnt find anything anymore (for as long as I stayed in the live ubuntu terminal) – Mark Jeronimus Feb 27 at 18:24
  • Can you post the smartctl as well? – Fabby Feb 27 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.