F25: How to force fsck at boot?

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

F25: How to force fsck at boot?

Frédéric Bron
I would like to force fsck at boot but I tried touch /forcefsck and it
did not run or I did not see it (however the file /forcefsck
disappeared).
Thanks,
Frédéric
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Fred Roller
I believe you could use tune2fs command

sudo tune2fs -c 50 /dev/[your dev]

the -c option set the interval of boots.  Change it to 1 and it will check every boot... 30 I believe is the current default because every boot is impractical imo.  I believe you can set the priority in the fstab.. last column if memory serves.  0 no check, 1 first, 2 after first.

-- Fred 

_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Robert Nichols-2
In reply to this post by Frédéric Bron
On 08/04/2017 12:05 AM, Frédéric Bron wrote:
> I would like to force fsck at boot but I tried touch /forcefsck and it
> did not run or I did not see it (however the file /forcefsck
> disappeared).

It probably ran and you didn't see it. For ext2/3/4, you can run

    tune2fs -l /dev/{whatever} | grep "Last checked"

--
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

TASAKA Mamoru
In reply to this post by Frédéric Bron
Frédéric Bron wrote on 08/04/2017 02:05 PM:
> I would like to force fsck at boot but I tried touch /forcefsck and it
> did not run or I did not see it (however the file /forcefsck
> disappeared).
> Thanks,
> Frédéric

Add the following to the boot parameter:
fsck.mode=force

Touching /forcefsck was for sysvinit and upstart era. It is no longer valid
for systemd.

Regards,
Mamoru

_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Frédéric Bron
In reply to this post by Robert Nichols-2
> It probably ran and you didn't see it. For ext2/3/4, you can run
>    tune2fs -l /dev/{whatever} | grep "Last checked"

Apparently, this does not work:
# tune2fs -l /dev/sda
tune2fs 1.43.3 (04-Sep-2016)
tune2fs: Bad magic number in super-block while trying to open /dev/sda
Found a gpt partition table in /dev/sda
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Dr. Robert Marmorstein
>Apparently, this does not work:
># tune2fs -l /dev/sda
>tune2fs 1.43.3 (04-Sep-2016)
>tune2fs: Bad magic number in super-block while trying to open /dev/sda
>Found a gpt partition table in /dev/sda

/dev/sda is usually a drive name, not a partition name.  Does it work if you try /dev/sda1 or /dev/sda2?
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Samuel Sieb
In reply to this post by Fred Roller
On 08/03/2017 11:05 PM, fred roller wrote:
> I believe you could use tune2fs command
>
> sudo tune2fs -c 50 /dev/[your dev]
>
> the -c option set the interval of boots.  Change it to 1 and it will
> check every boot... 30 I believe is the current default because every
> boot is impractical imo.  I believe you can set the priority in the
> fstab.. last column if memory serves.  0 no check, 1 first, 2 after first.

There is no need for this and it always happens at the worst time.  You
do an emergency reboot for some reason and then you have to wait for a
full fsck.
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Samuel Sieb
In reply to this post by TASAKA Mamoru
On 08/04/2017 06:46 AM, Mamoru TASAKA wrote:
> Touching /forcefsck was for sysvinit and upstart era. It is no longer valid
> for systemd.

This is still valid and has nothing to do with systemd.  It's handled by
dracut in the initramfs.
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Frédéric Bron
In reply to this post by Dr. Robert Marmorstein
>>Apparently, this does not work:
>># tune2fs -l /dev/sda
>>tune2fs 1.43.3 (04-Sep-2016)
>>tune2fs: Bad magic number in super-block while trying to open /dev/sda
>>Found a gpt partition table in /dev/sda
>
> /dev/sda is usually a drive name, not a partition name.  Does it work if you try /dev/sda1 or /dev/sda2?

It is the same but I found that I have to use /dev/nvme0n1p#
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Frédéric Bron
In reply to this post by Samuel Sieb
>> Touching /forcefsck was for sysvinit and upstart era. It is no longer
>> valid
>> for systemd.
>
> This is still valid and has nothing to do with systemd.  It's handled by
> dracut in the initramfs.

Yes, apparently from the last checked date, it seems that /forcefsck
worked but I was expecting to see something on the screen and it must
be done hidden.
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Frédéric Bron
In reply to this post by Fred Roller
> sudo tune2fs -c 50 /dev/[your dev]
>
> the -c option set the interval of boots.  Change it to 1 and it will check
> every boot... 30 I believe is the current default because every boot is
> impractical imo.  I believe you can set the priority in the fstab.. last
> column if memory serves.  0 no check, 1 first, 2 after first.

Apparently the default value is -1 on my partitions which according to
the manual means "If max-mount-counts is 0 or -1, the number of times
the filesystem is mounted will be disregarded by e2fsck(8) and the
kernel."

So I guess that fsck is then ran only in case of problems?

Frédéric
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Samuel Sieb
On 08/04/2017 09:59 PM, Frédéric Bron wrote:
> Apparently the default value is -1 on my partitions which according to
> the manual means "If max-mount-counts is 0 or -1, the number of times
> the filesystem is mounted will be disregarded by e2fsck(8) and the
> kernel."
>
> So I guess that fsck is then ran only in case of problems?

Yes.  It used to have a value, but it was not that helpful and could be
quite annoying.
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Samuel Sieb
In reply to this post by Frédéric Bron
On 08/04/2017 09:54 PM, Frédéric Bron wrote:
> Yes, apparently from the last checked date, it seems that /forcefsck
> worked but I was expecting to see something on the screen and it must
> be done hidden.

Unless there's a problem, it will run very quickly.
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Tim-163
In reply to this post by Samuel Sieb
On 5/8/2017 2:35 pm, Samuel Sieb wrote:
> It used to have a value, but it was not that helpful and could be quite
> annoying.

Back when hard drives were small, the occasional fsck was somewhat
annoying.  I'd really hate to be stuck waiting while the computer checks
through a 500 GB drive, just for the sake of it.

--
Trying out Thunderbird for mail.
5... 4... 3... 2... ONE!  Email has gone

Boilerplate:  All mail to this mailbox is automatically deleted, there
is no point trying to privately email me, I only get to see the messages
posted to the mailing list.
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Ahmad Samir
In reply to this post by Samuel Sieb
On 5 August 2017 at 06:50, Samuel Sieb <[hidden email]> wrote:

> On 08/04/2017 06:46 AM, Mamoru TASAKA wrote:
>>
>> Touching /forcefsck was for sysvinit and upstart era. It is no longer
>> valid
>> for systemd.
>
>
> This is still valid and has nothing to do with systemd.  It's handled by
> dracut in the initramfs.
>

The root / filesystem isn't force-checked with /forcefsck; you'd have
to use fsck.mode=force kernel boot parameter. I tested that on a clean
install in a vm. The other filesystems listed in fsck are checked
AFAICS.

systemd is deprecating /forcefsck, have a look at [1].

[1] https://github.com/systemd/systemd/search?q=forcefsck&type=

--
Ahmad Samir
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Frédéric Bron
> The root / filesystem isn't force-checked with /forcefsck; you'd have
> to use fsck.mode=force kernel boot parameter. I tested that on a clean
> install in a vm. The other filesystems listed in fsck are checked
> AFAICS.

Yes, I discovered that. All my filesystems were checked apart from /!

Frédéric
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Tim-163
In reply to this post by Ahmad Samir
Allegedly, on or about 6 August 2017, Ahmad Samir sent:
> The root / filesystem isn't force-checked with /forcefsck; you'd have
> to use fsck.mode=force kernel boot parameter. I tested that on a
> clean
> install in a vm. The other filesystems listed in fsck are checked
> AFAICS.
>
> systemd is deprecating /forcefsck, have a look at [1].
>
> [1] https://github.com/systemd/systemd/search?q=forcefsck&type=

I thought the point of having a /forcefsck file is that software can
touch it to automate triggering it.  I doubt that can be done with a
kernel parameter.  This seems a really backward step, to me.

--
[tim@localhost ~]$ uname -rsvp
Linux 4.11.11-300.fc26.x86_64 #1 SMP Mon Jul 17 16:32:11 UTC 2017 x86_64

Boilerplate:  All mail to my mailbox is automatically deleted.
There is no point trying to privately email me, I only get to see
the messages posted to the mailing list.

Linux servers are always being dæmonised...
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: F25: How to force fsck at boot?

Chris Murphy
/forcefsck is obsolete

Modern file systems are expected to determine themselves if fsck is
needed. XFS, ext4, btrfs, all can do log replay at mount time and that
fixes the vast majority of problems. On XFS and Btrfs, if log replay
has problems, mount will fail and it's expected the user manually runs
repair.

So right off the bat, /forcefsck would apply only to ext4 on Fedora.
But there's another gotcha which is the file system has to be
consistent enough to mount ro in order to find the forcefsck hint. So
it's kinda unreliable. Next it required the use of preen on a read
only mounted volume, which upstream doesn't recommend. From e2fsck 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"

In a somewhat recent systemd, it just pre-emptively runs the generic
fsck on rootfs before ro mount. On ext4 this causes e2fsck to get run
prior to ro mount which if the file system state is clean, it's a no
op. On XFS and Btrfs fsck is always a no op.


Chris Murphy
_______________________________________________
users mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Loading...