Re: Skipping fsck during boot with systemd?
- To: debian-user@lists.debian.org
- Subject: Re: Skipping fsck during boot with systemd?
- From: Marc Auslander <marcslists@gmail.com>
- Date: Mon, 29 Dec 2014 18:32:28 -0500
- Message-id: <[🔎] 87sifyuj5f.fsf@aptiva.optonline.net>
- In-reply-to: <oCa3M-6Xf-5@gated-at.bofh.it> (celejar@gmail.com's message of "Sun\, 28 Dec 2014 01\:40\:02 +0100")
- References: <ou9Hz-41a-3@gated-at.bofh.it> <ovJfY-8o3-9@gated-at.bofh.it> <ovJSG-Xw-1@gated-at.bofh.it> <ovKOJ-2qO-9@gated-at.bofh.it> <ovLrs-3to-17@gated-at.bofh.it> <ovN9U-5Qr-1@gated-at.bofh.it> <ovNMC-6S8-23@gated-at.bofh.it> <ow9N7-6YA-11@gated-at.bofh.it> <owfIS-7pB-9@gated-at.bofh.it> <owgOB-zm-1@gated-at.bofh.it> <owhrk-1AL-19@gated-at.bofh.it> <oCa3M-6Xf-5@gated-at.bofh.it>
Long ago, I decided that inconvenient fsck's were not what I
needed. And that cancelling them was not an option - I run quasi
headless so there's no way.
So - I use tune2fs to set a ridiculous reboot count for automatic
fsck. Then a run a cron job the does a reboot with the -F option once
a month in the middle of the night when I don't need the machine.
systemd won't change a thing for me.
cron job follows. it actually checks for a disk that needs an fsck.
#!/bin/bash
#check for fsck needed and force it and reboot if needed
[ "$1" = -force ] && force=yes
month=$(date +%b)
reboot=no
while read disk rest
do
lastfsck=$(tune2fs -l $disk | grep 'Last checked:')
lastfsck=${lastfsck:30:3}
[ "$lastfsck" = "$month" ] || reboot=yes
done << --end
$(df | egrep '^/dev')
--end
if [ "$force" != yes ]
then
[ $reboot = no ] && exit
if [ -n "$(who)" ]
then
echo 'Not rebooting because of logged on users'
who
exit
fi
fi
echo 'checkfsck rebooting' | mail -s checkfsck root
# -F below forces check of all filesystems, not just root
echo 'checkfsck rebooting'
shutdown -rF now
sleep 120
echo 'shutdown seems to be broken again'
shutdown -nrF now
sleep 120
echo 'shutdown -n seems to have failed'
sleep 120
touch /forcefsck
sync;sync;sync;sleep 60;reboot -f
sleep 120
echo 'it just wont die - need help'
Reply to: