When booting I get into the grub menu, choose recovery mode, select fsck, yes However error saying root partition is already mounted. I thought this method was designed to allow this before the root partition is mounted.
-
It can't umount the system partition , but you can do that using a live CD , try Ubuntu with out install and run terminal then type fsck /dev/sdx- as your system partition device information sda2 or any else. – Bassem Dec 21 '22 at 06:55
-
Does this answer your question? Can't run fsck in recovery mode in >18.04. Disk is mounted r/w – Daniel T Feb 21 '24 at 06:44
-
Does this answer your question? e2fsck: Cannot continue, aborting – karel Feb 21 '24 at 08:28
2 Answers
In older versions of Ubuntu, fsck
used to work from the Recovery Mode. However, later versions of Ubuntu leave the primary HDD/SSD mounted, so fsck
no longer works.
Let's check/repair your filesystem...
- boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode
- open a
terminal
window by pressing Ctrl+Alt+T - type
sudo fdisk -l
- identify the /dev/sdXX device name for your "Linux Filesystem"
- type
sudo fsck -f /dev/sdXX
, replacingsdXX
with the number you found earlier - repeat the
fsck
command if there were errors - type
reboot
Note: for Ubuntu Live, use Ubuntu Desktop, not Ubuntu Server (even if your environment is Ubuntu Server).

- 70,711
-
The
fsck -f
proposed in your solution unfortunately didn't work for me. fsck bails with a note that the /dev/sdaX is mounted. tune2fs marks mounts max count to 1 - so it does a fsck every time the OS boots... This can be reverted back to 29 (the default?). As you said, not ideal for sure, but it did work. Any ideas on how to force a fsck of a root filesys on reboot? It used to be possible now I can't find the flag for it. Doing atouch /forcefsck
does seem to do something - after the reboot the file is gone, but I didn't see fsck was run during boot. Another "ugly" solution. :) – omahena May 16 '22 at 11:54 -
1@omahena You tried to run fsck whilst booted to the Ubuntu disk... that's why it said it was mounted. You didn't do the very FIRST step... boot to a Ubuntu Live USB. – heynnema May 16 '22 at 13:07
-
Ah, you are right. I completely missed that. Apologies. I was trying to find a solution that doesn't require external bootable media. I am pretty sure the "force check" flag on fsck used to work differently in the past and marked the filesystem as dirty and asked you to reboot the system if the filesystem was in use. – omahena May 20 '22 at 07:56
Since posting the question I found 2 solutions on the net.
1.Force a fsck on each boot for an EXT4, EXT3 or EXT2 filesystem using: sudo tune2fs -c 1 /dev/sdXY eg sda3
2.This command uses Nano command line text editor to open /etc/default/grub so you can edit it: sudo nano /etc/default/grub
To force a fsck each time the computer boots, you'll need to add fsck.mode=force to GRUB_CMDLINE_LINUX_DEFAULT, at the end of the line but before the last quote (").
Example: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash fsck.mode=force"
After you've finished editing /etc/default/grub, update your Grub2 configuration: sudo update-grub

- 55
-
-
-
@Tiago Because both solutions modify an existing system that already has problems. Use my answer below to repair the system without first modifying it first. – heynnema Dec 19 '22 at 15:39