You are not logged in.

#1 2008-01-08 01:55:10

keerthi
Member
Registered: 2007-11-18
Posts: 95

fsck on shutdown

Is it possible to have fsck run during shutdown/reboot when it is due? Ubuntu has AutoFsck that does this. Anything similar for Arch? Thanks,

Offline

#2 2008-01-08 02:09:21

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: fsck on shutdown

It does already.

grep fsck /etc/rc.sysinit

Offline

#3 2008-01-17 17:22:46

keerthi
Member
Registered: 2007-11-18
Posts: 95

Re: fsck on shutdown

Thanks. But it seems to run on startup. How do I make it run on reboot/shutdown?

Offline

#4 2008-01-17 18:35:35

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: fsck on shutdown

/etc/rc.local.shutdown

this script is executed on shutdown/reboot

-m.


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#5 2008-02-14 17:43:00

keerthi
Member
Registered: 2007-11-18
Posts: 95

Re: fsck on shutdown

OK. May be I'm not clear. I would like to have fsck run during shutdown and NOT at startup similar to AutoFsck in ubuntu.

https://wiki.ubuntu.com/AutoFsck

Offline

#6 2008-02-14 18:01:54

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: fsck on shutdown

keerthi wrote:

May be I'm not clear.

You are not being clear at all. Explain *why* the disk checking should be done at shutdown. Or Startup.

*Whenever* it's done, it's always a pain in the arse.

Offline

#7 2008-02-14 18:55:05

GogglesGuy
Member
From: Rocket City
Registered: 2005-03-29
Posts: 610
Website

Re: fsck on shutdown

brebs wrote:
keerthi wrote:

May be I'm not clear.

You are not being clear at all. Explain *why* the disk checking should be done at shutdown. Or Startup.

*Whenever* it's done, it's always a pain in the arse.

May be because when you start the computer, you actually want to use the computer ASAP, while when you shut it  down, you don't mind if it stays on for those few minutes?

Offline

#8 2008-02-16 03:28:48

keerthi
Member
Registered: 2007-11-18
Posts: 95

Re: fsck on shutdown

May be because when you start the computer, you actually want to use the computer ASAP, while when you shut it  down, you don't mind if it stays on for those few minutes?

Exactly. Its disappointing when you have to wait for fsck to finish (it takes 30 mins to complete for me) when there is a need to "check" something real quick.

Offline

#9 2008-02-16 06:49:41

idjut
Member
From: Oslo
Registered: 2006-05-15
Posts: 177

Re: fsck on shutdown

keerthi wrote:

May be because when you start the computer, you actually want to use the computer ASAP, while when you shut it  down, you don't mind if it stays on for those few minutes?

+1

Why is this not standard?


Linux user #403491

"Men have called me mad; but the question is not yet settled, whether madness is or is not the loftiest intelligence– whether much that is glorious– whether all that is profound– does not spring from disease of thought– from moods of mind exalted at the expense of the general intellect." - E. A. Poe from Eleonora

Offline

#10 2008-02-16 09:58:48

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: fsck on shutdown

You could install AutoFsck. However, note that it is not (yet) installed as standard, even in Ubuntu (has reliability concerns?). See Ubuntu thread for discussion. Reasons against it:

* Having the laptop battery run out of charge half-way through a fsck is not a good thing. You will all be moaning 10 times louder if you start getting corrupted partitions wink
* Use tune2fs, to change the default of checking the disk annoyingly often, e.g.:  tune2fs -c 0 -i 2m /dev/sda1
* The annoying delay will hopefully be quicker with ext4.

I love this quote:  "he had closed his laptop lid and not noticed the AutoFsck dialogue, it had then spent over an hour running in the bag with him on his journey home, and was almost out of power, all not good."

Offline

#11 2008-02-16 14:54:07

GogglesGuy
Member
From: Rocket City
Registered: 2005-03-29
Posts: 610
Website

Re: fsck on shutdown

brebs wrote:

You could install AutoFsck. However, note that it is not (yet) installed as standard, even in Ubuntu (has reliability concerns?). See Ubuntu thread for discussion. Reasons against it:

* Having the laptop battery run out of charge half-way through a fsck is not a good thing. You will all be moaning 10 times louder if you start getting corrupted partitions wink

That can also happen when you do it on startup (in case you forgot your charger) ...

Offline

#12 2008-02-16 16:18:54

tigrmesh
IRC Op
From: Florida, US
Registered: 2007-12-11
Posts: 794

Re: fsck on shutdown

It seems to me that it would be simple for you to create a script that would run fsck and set the script to run at shutdown.  Or even have the script do the shutdown for you.

The fsck at bootup would always go quickly because the real check would already be done.

Offline

#13 2008-02-16 17:54:40

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: fsck on shutdown

add to rc.local.shutdown

#!/bin/bash
NETFS="nonfs,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,nousbfs,noshfs,nofuse,nofuseblk"

if (( `tune2fs -l /dev/sda2 | awk '/Mount count/{print $3}'` > `tune2fs -l /dev/sda2 | awk '/Maximum mount count/{print $4-1}' ))
then /sbin/fsck -A -T -C -a -t $NETFS 2>/dev/null
fi

this is my first bash script, hello world! Damn I'm satisfied smile

I don't know how to set gawk field separator to ":+random number of spaces" in order for the script to be less hackish.

Last edited by carlocci (2008-02-16 17:55:48)

Offline

#14 2008-03-27 20:31:28

warlord
Member
Registered: 2007-07-04
Posts: 58

Re: fsck on shutdown

there is also a script here (quite old)
http://bbs.archlinux.org/viewtopic.php?id=15496


I also prefer to check my filesystems when I shutdown (only shutdown, not when I reboot)

Anyone tried those scripts?

Offline

#15 2008-03-29 21:04:10

retsaw
Member
From: London, UK
Registered: 2005-03-22
Posts: 132

Re: fsck on shutdown

The problem with putting that script in your rc.local.shutdown is that rc.local.shutdown is executed before the filesystems are remounted from read-write to read-only and you should/must have a filesystem unmounted or mounted read-only if you are running fsck on it.

That script (actually it's a modification to the rc.shutdown script) linked to should work okay, however it forces a fsck check on every shutdown whether it is needed or not, but doesn't run when you are just rebooting.  But I haven't actually tested it myself,

Offline

Board footer

Powered by FluxBB