WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Reimplementing checkfs boot option. (personal interests)  (Read 3352 times)

Offline sandras

  • Jr. Member
  • **
  • Posts: 53
Reimplementing checkfs boot option. (personal interests)
« on: March 23, 2010, 07:58:44 AM »
I did a little research on checkfs and found out that it was dropped in TC/MC 2.4rc2. I checked the version 2.3.1 and also found out that the checkfs boot option worked not quite the way I was expecting it to. It forced the check and rebooted the system every time after performing the it.

I wanted my Microcore 2.10 setup to check file systems at boot time. But I didn't want it to force the check every time. I wanted a routine check. Something like in my past days of Ubuntu, where I didn't have to do the check manually.

Now, all what I added to tc-config script in MC 2.10 is found on the line 85 and lines 149 to 161 in the script attached. Those lines are taken from the version 2.3.1 tc-config script.

I made some changes though. Removed the n flag from echo command in the 156th line. Just my personal preference. On the 157th line I removed f flag from the e2fsck and added & at the end to enable the rotdash $! on the following line. The part that reboots the computer after checking the file systems is absolutely gone.

I remember Ubuntu rebooting if it did any checking on the file systems at boot time. Is it necessary to reboot after checking them? And what additions are needed to this script for it to act the same way if so?

I'm only able to make little changes to scripts or strip them down, so that's why I'm asking, but I thought I'd share this anyway.
« Last Edit: March 23, 2010, 04:38:23 PM by Sandras »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Reimplementing checkfs boot option.
« Reply #1 on: March 23, 2010, 08:37:23 AM »
Whether to reboot depends on e2fsck's return code:

Quote
The exit code returned by e2fsck is the sum  of  the  following  condi-
       tions:
            0    - No errors
            1    - File system errors corrected
            2    - File system errors corrected, system should
                   be rebooted
            4    - File system errors left uncorrected
            8    - Operational error
            16   - Usage or syntax error
            32   - E2fsck canceled by user request
            128  - Shared library error

Also, instead backgrounding and rotdash, how about adding "-C 0" to use its progress bar?
The only barriers that can stop you are the ones you create yourself.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Reimplementing checkfs boot option.
« Reply #2 on: March 23, 2010, 03:05:29 PM »
You should read the forum posts why it was removed.
10+ Years Contributing to Linux Open Source Projects.

Offline sandras

  • Jr. Member
  • **
  • Posts: 53
Re: Reimplementing checkfs boot option.
« Reply #3 on: March 23, 2010, 04:38:18 PM »
@curaga
Thanks, the "-C 0" flag makes the checking process more informative and looks really neat. Also removed "&". But I don't really know what's the exit code or how to check it. Did some googling but had no luck.

@roberts
I did read some posts but I'm not suggesting to bring the checkfs option back to TC. Now that I think about it, it may seem this way because of the thread title. I'll edit that one.
« Last Edit: March 23, 2010, 04:40:28 PM by Sandras »

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: Reimplementing checkfs boot option. (personal interests)
« Reply #4 on: March 23, 2010, 05:02:14 PM »
To grep exit code, do like this:

# e2fsck /dev/hda3
# echo $?


and that will spit out an exit number.

Offline sandras

  • Jr. Member
  • **
  • Posts: 53
Re: Reimplementing checkfs boot option. (personal interests)
« Reply #5 on: March 23, 2010, 05:16:51 PM »
Thanks man! Time to play some more with the script.

Edit: Well, I reworked it a bit. It should now reboot if the e2fsck exit code is 2 on any of the checked filesystems. Attached the script if someone would like to use/improve/correct it.
« Last Edit: March 24, 2010, 08:55:35 AM by Sandras »