WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to run fsck at boot time?  (Read 4494 times)

Offline BobStewart

  • Newbie
  • *
  • Posts: 6
How to run fsck at boot time?
« on: June 29, 2011, 06:50:29 PM »
I'm running the kernel version 2.6.33.3 of tinycore off of a flashdisk in a embedded device.  What, if anything, can I set to cause fsck to be run during boot?

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: How to run fsck at boot time?
« Reply #1 on: June 29, 2011, 09:55:20 PM »
That is no longer supported, and on a portable system is not recommended.
An improperly run fsck can destroy the file system. On a USB booting system
with an unpredictable mix of drives and filesystems,
this could be extremely dangerous.

Offline BobStewart

  • Newbie
  • *
  • Posts: 6
Re: How to run fsck at boot time?
« Reply #2 on: June 30, 2011, 11:17:20 AM »
The problem that I am trying to solve is that the product I'm developing runs headless, no video capability at all, up in the ceiling supposedly 24/7/365.  However loss of power causes the units to reboot.  After some number of reboots, I am seeing corruption in the file system (due to not being shut down correctly) that ONLY gets resolved by running fsck.  Manually running fsck is not feasible in the final product.  I think that the choice to not provide this capability was not a good one.  The hooks should be included to allow it.  It would then be up to the person using Tinycore to activate it or not with the default distro to not activate automatic fsck.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: How to run fsck at boot time?
« Reply #3 on: June 30, 2011, 11:26:13 AM »
You might use the copy2fs flag and then umount the drive, or remount it readonly.
This should remove any possibility of fs corruption.

The developers removed the option.
My suggestion:
If you can think of a safe way to auto fsck, outline it and open it for discussion.
Once all the holes have been plugged, the developers may reconsider.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: How to run fsck at boot time?
« Reply #4 on: June 30, 2011, 01:15:01 PM »
If you don't have sufficient ram to do the above, you can edit tc-config to run e2fsck at a suitable time (before rebuildfstab?).
The only barriers that can stop you are the ones you create yourself.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: How to run fsck at boot time?
« Reply #5 on: June 30, 2011, 09:01:53 PM »
The problem is identifying what needs the fsck before it is mounted.
This must occur before any tczs are loop mounted.
Perhaps a boot code such as fsck=sda1,sdb2.
Then what is the proper action if an fsck fails?

When testing new features in tc-config I use a second initrd containing only the modfied files.
« Last Edit: June 30, 2011, 09:04:14 PM by gerald_clark »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: How to run fsck at boot time?
« Reply #6 on: July 01, 2011, 03:06:40 AM »
I was thinking more a one-off remaster for this specific embedded device. It should always have the same device.
The only barriers that can stop you are the ones you create yourself.

Offline BobStewart

  • Newbie
  • *
  • Posts: 6
Re: How to run fsck at boot time?
« Reply #7 on: July 01, 2011, 11:07:32 AM »
Quote
If you don't have sufficient ram to do the above, you can edit tc-config to run e2fsck at a suitable time (before rebuildfstab?).

That is an excellent suggestion!  I will try it.

Thank you VERY much!

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: How to run fsck at boot time?
« Reply #8 on: July 01, 2011, 11:32:38 AM »
I had a checkfs boot code in Tiny Core up to version 2.4.
Use forum Search feature to see discussion and why it was removed. 
10+ Years Contributing to Linux Open Source Projects.