Score:0

How to run fsck on the root partion from the Grub menu

ru flag

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.

heynnema avatar
ru flag
Status please...
Bassem avatar
sr flag
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.
Score:1
ru flag

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, replacing sdXX with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot
omahena avatar
ba flag
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 a `touch /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. :)
heynnema avatar
ru flag
@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.
omahena avatar
ba flag
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.
Score:0
ru flag

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

heynnema avatar
ru flag
These are not the best solutions.
Tiago avatar
jp flag
@heynnema why? more details please
heynnema avatar
ru flag
@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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.