Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ful fsck whenever journal replay is needed?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9882
Location: almost Mile High in the USA

PostPosted: Fri Sep 01, 2023 10:08 pm    Post subject: ful fsck whenever journal replay is needed? Reply with quote

Is there a way to make bootup fsck to do a full check whenever a filesystem journal replay is needed?

There's someone I know that thinks that crashes are normal (because that's how windows works) and it's ok to hard power off machines because there seems to be no consequence. Yes, the journal does help, but I want to make it more painful (i.e. fsck) to not actually think about fixing the problem...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23066

PostPosted: Fri Sep 01, 2023 10:20 pm    Post subject: Reply with quote

If you really want to make it painful, just disable the journal. ;) Mount everything unjournaled. It will be slightly faster in the good case, and have a much higher risk of serious problems in the bad case.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9882
Location: almost Mile High in the USA

PostPosted: Fri Sep 01, 2023 11:09 pm    Post subject: Reply with quote

That unfortunately would cause more pain if the machine wouldn't start up again the next boot. I'm remote administering but sent components to them to self repair but doesn't know their way around root, etc. - and also the main reason why there's no effort to repair the cause of the crashes - rather it's better that something runs and crashes than doesn't run at all...

sigh.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54808
Location: 56N 3W

PostPosted: Sat Sep 02, 2023 2:22 pm    Post subject: Reply with quote

eccerr0r,

Some checkers accept the -f option.
Some run that way if you
Code:
touch force
at the top level of the filesystem.
If that works for you make it immutable or the checker will delete the file.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9882
Location: almost Mile High in the USA

PostPosted: Sun Sep 03, 2023 3:30 am    Post subject: Reply with quote

somehow need to touch the file if and only if the journal was replayed?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54808
Location: 56N 3W

PostPosted: Sun Sep 03, 2023 9:27 am    Post subject: Reply with quote

eccerr0r,

I don't see that happening.
mount will do the journal replay if the filesystem is flagged 'dirty' no fsck required.

You would need to check the dirty bit before mount got to it, then run a full filesystem check before any mount was attempted.
You can do that in the initrd if you really wan to. It has to be before root is mounted.

That's the same as just turning off the journal though - which on extX is far easier.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2202

PostPosted: Sun Sep 03, 2023 11:00 am    Post subject: Re: ful fsck whenever journal replay is needed? Reply with quote

eccerr0r wrote:
... There's someone I know that thinks that crashes are normal (because that's how windows works) and it's ok to hard power off machines because there seems to be no consequence. ...

A wise person once pointed out to me that as the filesystem always needs to check it's OK (to some extent) before the initial mount, and since the journal is always there, why bother to shut down cleanly?
The discussion moved on to point out that the journal IS the file system, since you can recreate the file system at any point in time from the journal (qua checkpoints that erase journal history). What we call the file system is really just a cache of the most recent journal entries. This is particularly true when you add in OS filesystem caches holding fragments of files, and possibly hardware caches holding fragments of updates....
_________________
Greybeard
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3491

PostPosted: Sun Sep 03, 2023 11:55 am    Post subject: Reply with quote

Quote:
There's someone I know that thinks that crashes are normal (because that's how windows works) and it's ok to hard power off machines because there seems to be no consequence.
Crash-only design is actually a good practice. I don't know how well windows handles it; safe design is not always the easiest way to achieve the primary objective, and can come with performance penalty or other drawbacks.
Still, just because things have "always" been done in a certain way, does not mean it's the right way (though admittedly, more often than not, it was good enough for the time)

Quote:
es, the journal does help, but I want to make it more painful (i.e. fsck) to not actually think about fixing the problem
Ext by default only journals metadata. Why not enable full journaling instead of forcing fsck?
Or put him on f2fs instead. I did it with me rpis... Sure, wear leveling flash memory was one reason, but they also suffer from too frequent power outages.
They no longer die after a few blackouts.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9882
Location: almost Mile High in the USA

PostPosted: Sun Sep 03, 2023 12:11 pm    Post subject: Reply with quote

How about this as a reason for not wanting hard power offs: I'm logged in remotely (to do emerge -u kind of maintenance that is never done) and whether or not the console crashed or not, my remote session is fine. I don't mind the shutdowns but it's annoying to try to tell whether it was a crash or network failure which is possible. I'd rather be alerted of a clean shutdown which is perfectly fine.
I believe the crashes are caused by failing hardware which I have sent, but so far refuses to install that would make the crashes go away.
Not sure why I care so much about keeping the machine up to date and healthy more than the user but that's the way it goes...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3491

PostPosted: Sun Sep 03, 2023 2:48 pm    Post subject: Reply with quote

I see. Well, a multiuser machine is a different case.
It's a bit weird though, I think my PC does run fsck after every power outage and after 3 months since the last check (adjustable with tune2fs).
Code:
       -C mount-count
              Set the number of times the file system 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 file system at the next
              reboot.

You could abuse mount counter. Enable fsck every 2 mounts and create a service which will bump mount count to 3 on startup and reset to 0 at shutdown.
Keeping value low will make it necessary for the service to run and let it postpone another check.
Quote:
Not sure why I care so much about keeping the machine up to date and healthy more than the user but that's the way it goes...
That's a great question actually.
I don't mind doing some basic maintenance for friends, but I only do that when I happen to be around. Even if it's once every few months, it's still going to be good enough... They're not exactly high-profile targets.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9882
Location: almost Mile High in the USA

PostPosted: Sun Sep 03, 2023 8:48 pm    Post subject: Reply with quote

Interesting, I usually do not need to fsck unless the max mount count is exceeded whether it's resetting from a hard crash or power outage. Are you using a journalled file system? It should (usually) just replay and you're on your way for ext3, ext4fs...

But thanks that seems like something to think about, perhaps keep an actual count in-band or somewhere so that if it really has been 50 mounts it will fsck anyway.

Anyway I suppose I like having root access on remote machines that I don't need to pay for internet, electricity, or "rack space" ... it's too bad it's not up 24/7 but I tend to still get honored uptime on occasion, just need to make sure it's not -too- often. Alas much of that uptime is dedicated to emerge -uD firefox ...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3491

PostPosted: Sun Sep 03, 2023 11:20 pm    Post subject: Reply with quote

Yeah, ext3 has always had journal enabled by default. You got me thinking though, something ain't right :lol:
You can tune2fs routine scans based on time since the last fsck. E.g. debian used to set it to 1 month. Back in the days of lenny, at least. I think they changed it to 3 months afterwards.
It's independent of mount count, tripping either threshold is enough to trigger a check.

man tune2fs does not recommend those scheduled checks though. I guess it depends on how paranoid you are.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9882
Location: almost Mile High in the USA

PostPosted: Mon Sep 04, 2023 7:03 pm    Post subject: Reply with quote

Yeah I don't think it's of much value to fsck a disk, put it away for a year, and next time you use it, it needs to fsck again -- especially since fsck doesn't read every single block anyway. Only if it reads every block or one needed to write to the disk should it have some value for a check, and mounting a disk r/w counts as a write.

Then there's the argument that replaying a journal is a write too...it sure is...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23066

PostPosted: Mon Sep 04, 2023 7:56 pm    Post subject: Reply with quote

A filesystem check can be useful for finding filesystems which have started to go corrupt due to software bugs, as well as damage caused by hardware returning wrong data. I suspect the idea behind time-based checks was that a server which is powered up constantly would only ever mount the filesystem when forced to reboot by kernel update or power outage. Such a system might accumulate many hours of usage and writes to the filesystem (and thus many opportunities for rare bugs to manifest at least once), but take a year to accumulate even 12 mounts (supposing that it only takes major kernel updates, rather than every time "all users must upgrade"). Time-based checks ensure that it is still checked periodically, possibly even every reboot if uptime is normally measured in months.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum