[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Skipping fsck during boot with systemd?



On Wed, 10 Dec 2014, Andrei POPESCU wrote:
> On Mi, 10 dec 14, 07:32:07, Renaud OLGIATI wrote:
> > In my case no, more likely during shut-down, since the only time I 
> > shut down my box is when there is a power cut, and I have to shut it 
> > down quickly, before the UPS gives up. So I certainly do not want an 
> > unwanted automatic fsck at that time.
> 
> That would be easy to implement, assuming you computer "knows" it's 
> running on batteries.

That's unfortunately a bigger "if" than it should be, but it is easy to do
if you assume anyone with a broken platform that does it wrong gets to pick
up the pieces.

(sample code we used in Debian Lenny, since disabled due to #526398.  Yes,
we have "on_ac_power", it is on package "powermgmt-base").

if which on_ac_power >/dev/null 2>&1
then
        on_ac_power >/dev/null 2>&1
        if [ $? -eq 1 ]
        then
		<we are on battery>
	else
		<we are on AC power>
        fi
else
	<we do not know power supply state>
fi

However, do NOT even THINK about skipping *boot* fsck in the general case:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526398

So, you cannot "move" fsck from boot to shutdown without endangering user
data.

There is a reason why Linux system administration 101 teaches you to disable
periodic fsck for ext2/3/4 *on the filesystem* using tune2fs on boxes that
cannot take the time hit on boot.  You still run fsck on every boot, but it
will not "force" a check every n days/n mounts.

Now, we certainly could address disabling periodic fsck for ext2/3/4 by
default (I don't think other filesystems have this feature).

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


Reply to: