Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

I located a way to manually force a fsck at boot.

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
johngoodin
Posts: 15
Joined: 2007-06-03 18:57

I located a way to manually force a fsck at boot.

#1 Post by johngoodin »

I located a way to manually force a fsck at boot.

HOWTO: Force fsck on boot using /forcefsck

By creating empty /forcefsck file you will force the Linux system (or rc scripts) to perform a full file system check.

Login as the root:
$ su -

Change directory to root (/) directory:
# cd /

Create a file called forcefsck:
# touch /forcefsck

Now reboot the system:
(Be sure you have no unsaved work before this last command)
# reboot

==================================

Q: Can I create a shell or script that I can launch from the
desktop and make fsck run the very next time I boot?

Better yet!

AKA Windows Scandisk after bad shutdown...

Is there a way to force linux to do a fsck if linux is not shutdown correctly?

I was thinking around the lines of making linux automatically create the empty
/forcefsck at boot and delete it during a proper shutdown.

If the system hung/locked up forcing a manual power off via the power button the empty /forcefsck would not be deleted and a fsck would follow at next boot. The same if the power was lost.

User avatar
987687
Posts: 2110
Joined: 2007-06-11 10:58
Location: Vacation Land

Re: I located a way to manually force a fsck at boot.

#2 Post by 987687 »

Good idea. It would be fairly easy to do that. Just make an init script that checks for the fsckcheck file on boot. If it isn't there, create it, if it is there, run fsck, and then create it.
Another init script on shut down to delete the file. Then obviously if it doesn't shut down right the file will still be there for next boot.

One thing I'm not sure of is if fsck is run before init starts or not ... this wouldn't completely foil it though, instead it could just set the partition to fsck every boot, and set it back on shutdown.
Desktop - 3.2GHz core2 quad
Laptop - 2.4GHz core2 duo ancient macbook
Bring back the penguin!! http://tinyurl.com/d57jwv

smallchange
Posts: 1740
Joined: 2009-05-04 15:56
Been thanked: 1 time

Re: I located a way to manually force a fsck at boot.

#3 Post by smallchange »

Those M$ people are so smart. Why did it never occur to any Unix engineer to cause the file system to be checked at boot if it was not shutdown properly?

User avatar
KeithHedger
Posts: 17
Joined: 2009-12-07 19:55
Location: Devon, U.K.

Re: I located a way to manually force a fsck at boot.

#4 Post by KeithHedger »

I've just come over from ubuntu but as that is a debian system as well and so I presume works much the same way, I think you will find that if the system disk or home partition if you are using one is not cleanly unmounted it will do an fsck anyway, you may have just missed the check though as it can be quite speedy.
Pleas correct me if i'm wrong as i'm still exploring debian at the moment

P.S. just looked the files that do the startup check are at /etc/init.d/checkfs.sh and /etc/init.d/checkroot.sh
In /dev/null no one can hear the kernel panic

Post Reply