LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-26-2017, 11:50 AM   #1
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Testing, yet again!
Posts: 436

Rep: Reputation: 97
Concerning fsck.ext4


First off, I looked on linuxquestions.org using the terms "systemd, fsck, and parameter". Got only one response, but it did me no help.

Here is what I want to do:

When it is time for an automatic fsck, I would like it to run the parameter "-D"

That's it, plain and simple. How can I force systemd (spit) to run systemd-fsck-service (or whatever they call it) to throw a "-D" in the command, without having to unmount partitions, run fsck, remount partitions, and use a rescue disk to do this to my root partition.

Just wondering.....

And, thank you for any advice you may give.
 
Old 10-26-2017, 12:06 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,353
Blog Entries: 13

Rep: Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411
Hi,

Perhaps you have mistyped. What version of fsck are you running which supports a -D option?

I'm not true expert, however I have managed to find the systemd files which run a given service and modified them from time to time.

Usually in the .service file you can put in options for what you intend to run. You can also specify a script to be run and from within that script you can put in whichever fsck options you desire.

Are you looking in the /etc/systemd tree and looking under the multi-user.target.wants directory?

My understanding is that fsck will run on mounted file systems in fact if given no parameters, it is supposed to use the /etc/fstab file to find file systems to check. Just unsure what it will do for mounted file systems, either nothing given that they're mounted and only give a report, or it will "try" to do something, but stop if/when it hits a blocking point.
 
Old 10-26-2017, 12:13 PM   #3
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Testing, yet again!
Posts: 436

Original Poster
Rep: Reputation: 97
The version is in the title, "fsck.ext4"

Most importantly, never ever in a thousand years run fsck on a mounted partition, or it will fsck up your partition... sort of.

Also.... I am totally lost about systemd. I will look at the /etc/systemd tree, and see what I will see.

Thank you for your quick response.
 
Old 10-26-2017, 12:26 PM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,353
Blog Entries: 13

Rep: Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411
So therefore e2fsk. OK, and yes that does have a -D option. Sorry for missing that earlier. And that is merely something to do with optimizing directories as it does its work.

I know that it is inadvisable to run fsck on a mounted file system.

I believe your first post said that you wished to do this:
Quote:
Originally Posted by kevinbenko View Post
without having to unmount partitions, run fsck, remount partitions, and use a rescue disk to do this to my root partition.
I don't know how you can have fsck check your root partition using system services, as well as fsck which likely resides on that root partition, without umounting the root partition, or never having mounted it by way of starting using a live media. Therefore I was citing that fsck can technically examine a mounted file system and check it.

Perhaps you can be more clear as to what you want to happen. Are there multiple file systems you wish to check? Do you intend to check your RFS also? How would you like this service to operate, at startup, frequently/periodically, or some other variation? Note also that if you have systemd running services, your RFS is mounted. So if you're thinking that systemd somehow is not involved with a mounted file system ... Sorry, just guessing what you really wished to have happen here.
 
Old 10-26-2017, 01:52 PM   #5
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Testing, yet again!
Posts: 436

Original Poster
Rep: Reputation: 97
Periodically, based on the number of days since it did a last fsck, or the number of mounts since the last fsck, it will automatically do an fsck that is set using "tune2fs", if it is time to fsck the root partition, it does it. I think it may be in RO-mode (rather than RW-mode).

If I remember correctly, under sysvinit (ahhh... the good old days) I had set my fsck to run with "-D".

I am away from my home computer right now, but I will give a look when I get home.
 
Old 10-27-2017, 12:01 PM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,229
Blog Entries: 4

Rep: Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260
fsck.ext4 is normally invoked from, and by, the usual fsck command, after it has identified that the particular disk is using the ext4 file system.

I'm quite puzzled, though, why you feel the need to run a filesystem check as a scheduled task!
 
Old 10-27-2017, 04:01 PM   #7
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Testing, yet again!
Posts: 436

Original Poster
Rep: Reputation: 97
No.
Linux does this automatically after a certain number of mounts (or time).
So, it is inherent in a Linux kernel, via tune2fs.
 
Old 10-27-2017, 08:28 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,769

Rep: Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571
Quote:
Originally Posted by manpage
This can sometimes make them a little smaller and slightly faster to search, but in practice, you
should rarely need to use this option.
So Ted is telling you it's a waste of time.
Personally I've found it worthwhile listening to him.
 
  


Reply

Tags
systemd fsck


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] fsck.ext4 no such file or directory while trying to open ganesh24pal@gmail.com Linux - Newbie 3 01-24-2017 02:28 PM
[SOLVED] speed of a fsck of an ext4 volume anon091 Linux - Server 4 07-03-2013 08:39 AM
ext4 won't mount - fsck required - 2nd fsck in less than a week td3201 Linux - General 1 09-10-2012 12:07 AM
How to fsck ext4? windstory Linux - Newbie 3 07-26-2011 07:40 PM
ext4 needs a fsck every other boot con Linux - Hardware 4 08-21-2009 02:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration