fsck on reboot

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Wheelspin
Level 2
Level 2
Posts: 72
Joined: Mon Jul 14, 2014 6:27 pm

fsck on reboot

Post by Wheelspin »

I used:

tune2fs -C 2 -c 1 /dev/<boot partition>

to force a fsck on boot. However, it doesn't appear to do anything. Should I be expecting some sort of UI (textual or graphical) during the next boot to indicate the check in progress or is it completely silent?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: fsck on reboot

Post by Laurent85 »

Use:

Code: Select all

sudo touch /forcefsck
Upon reboot a filesystem check will be run.
Image
User avatar
Pierre
Level 21
Level 21
Posts: 13215
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: fsck on reboot

Post by Pierre »

you may have to goto a full shutdown, rather than a reboot,
- in order to get that to run, though.
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.
Wheelspin
Level 2
Level 2
Posts: 72
Joined: Mon Jul 14, 2014 6:27 pm

Re: fsck on reboot

Post by Wheelspin »

I had already tried the forcefsck file, but I just tried it again with a full shutdown and it was no different. I get the grub menu then a black screen for a few seconds and then the login gui appears. There's no feedback that a file system check has occurred.
Mute Ant

Re: fsck on reboot

Post by Mute Ant »

Code: Select all

man tune2fs
-C mount-count
Set the number of times the filesystem has been mounted. If set to a greater value than the max-mount-counts parameter set by the -c option, e2fsck(8) will check the filesystem at the next reboot.

So the first reboot wouldn't do a file check with -c2 -C2 (the next one would).

If you look in the logs, the kernel will have reported the boot activity.

The default setting for GRUB is quiet splash so you won't see the check when it happens...and if the journal is empty, a few seconds is all it takes, no test that the data is intact at all.
Wheelspin
Level 2
Level 2
Posts: 72
Joined: Mon Jul 14, 2014 6:27 pm

Re: fsck on reboot

Post by Wheelspin »

Yeah, I was following the man page when I ran it. Probably just typed it out wrong on here.
Mute Ant wrote:

Code: Select all

man tune2fs
If you look in the logs, the kernel will have reported the boot activity.
Which log and where?
Mute Ant wrote:

Code: Select all

man tune2fs
The default setting for GRUB is quiet splash so you won't see the check when it happens...and if the journal is empty, a few seconds is all it takes, no test that the data is intact at all.
[/quote]

ok, so what's the best way to turn off quiet splash temporarily?
Mute Ant wrote:

Code: Select all

man tune2fs
...and if the journal is empty, a few seconds is all it takes, no test that the data is intact at all.
[/quote]

How do I force it run a full FS check and disk integrity check? I'm seeing some odd system behaviour and I what to be sure that I've not got any disk corruption.
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: fsck on reboot

Post by Cosmo. »

Wheelspin wrote:so what's the best way to turn off quiet splash temporarily?
If you see the grub menu and the entry for your system is marked press e. This gives you an editor window. Remove further down the parameter quiet and splash, than press F 10 to boot. This is a one time change which doesn't get stored.
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: fsck on reboot

Post by Laurent85 »

If the file /forcefsck was removed that would confirm the filesystem check was performed. If you need to manually run fsck you can boot the usb installation flash drive and use gparted or the command line.
Image
GeneBenson
Level 4
Level 4
Posts: 357
Joined: Fri Sep 17, 2010 9:55 pm

Re: fsck on reboot

Post by GeneBenson »

Hi Wheelspin,

Have you tried sudo tune2fs -l /dev/<boot partition> ?
This will show you some interesting things like "Last checked:"
Should I be expecting some sort of UI (textual or graphical) during the next boot to indicate the check in progress or is it completely silent?
In my experience you don't get feedback on smaller partitions because it happens so fast. I only get feedback on larger partitions.
User avatar
karlchen
Level 23
Level 23
Posts: 18211
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: fsck on reboot

Post by karlchen »

Wheelspin wrote:I used:
tune2fs -C 2 -c 1 /dev/<boot partition>
to force a fsck on boot. However, it doesn't appear to do anything.
Should this not read

Code: Select all

sudo tune2fs -C 2 -c 1 /dev/<boot partition>
because tune2fs requires root privileges?
Second question: Is the boot partition the same partition that holds the root file system / which you want to check?

I use the commandline

Code: Select all

sudo tune2fs -C MountCount /dev/sdaNo
every once in a while in order to schedule an fsck on the root filesystem during next reboot. And it has always worked as expected here. I.e. fsck will be run on the specified partition during next reboot, no matter whether warm boot or cold boot.

Note:
MountCount - mount count, usually set as interval between fsck's plus 1
No - number of partition on disk /dev/sda

--
P.S.:
I guess I will give the

Code: Select all

sudo touch /forcefsck
approach a try next time, provided long lasting habits don't make me type the commandline that I have got used to. :wink:
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
Wheelspin
Level 2
Level 2
Posts: 72
Joined: Mon Jul 14, 2014 6:27 pm

Re: fsck on reboot

Post by Wheelspin »

GeneBenson wrote:Have you tried sudo tune2fs -l /dev/<boot partition> ?
This will show you some interesting things like "Last checked:"
Last Checked 11/02/2015. However, the forcefsck file is being removed.
Wheelspin
Level 2
Level 2
Posts: 72
Joined: Mon Jul 14, 2014 6:27 pm

Re: fsck on reboot

Post by Wheelspin »

Removing quiet splash from the boot options didn't reveal anything useful. Both of the log files:

/var/log/fsck/checkfs
/var/log/fsck/checkroot

contain the following:

(Nothing has been logged yet.)
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: fsck on reboot

Post by Cosmo. »

Wheelspin wrote:(Nothing has been logged yet.)
Probably this long standing bug.
Wheelspin
Level 2
Level 2
Posts: 72
Joined: Mon Jul 14, 2014 6:27 pm

Re: fsck on reboot

Post by Wheelspin »

Are you aware of any Mint plans to rectify it if Ubuntu can't be arsed?
elina

Re: fsck on reboot

Post by elina »

so complicated.
GeneBenson
Level 4
Level 4
Posts: 357
Joined: Fri Sep 17, 2010 9:55 pm

Re: fsck on reboot

Post by GeneBenson »

Hi Wheelspin,

One more thing to try. Have a look at /etc/fstab. Find the entry for your boot partition. The very last number on the right needs to be a "1". If it is "0" fsck will skip checking it. If you have any other partitions you want to check, excluding "Swap", then their values should be set to "2". Like this:

Code: Select all

UUID=0b361f58-db4b-4dd6-9ca0-fb84d0bdba33   /               ext4    noatime,errors=remount-ro 0       1
UUID=bb1e1afb-a24e-4671-a3fa-b3be3fe193df   /mnt/Backup     ext4    defaults,noatime   0       2
Are you aware of any Mint plans to rectify it if Ubuntu can't be arsed?
I see the same on Debian so the problem not just a Ubuntu/Mint issue. Will it ever be fixed? Who knows. :(
Wheelspin
Level 2
Level 2
Posts: 72
Joined: Mon Jul 14, 2014 6:27 pm

Re: fsck on reboot

Post by Wheelspin »

GeneBenson wrote:One more thing to try. Have a look at /etc/fstab. Find the entry for your boot partition. The very last number on the right needs to be a "1". If it is "0" fsck will skip checking it. If you have any other partitions you want to check, excluding "Swap", then their values should be set to "2
The root partition is set to 1. The rest are 0. Since it's the root that I'm trying to check, I assume that that's not the problem.
Locked

Return to “Software & Applications”