On 2021-02-13 23:31, Clem Cole wrote:
> Cesar, you need to be careful. fsck -p -t scratch_filemay not be
> (probably is not) what you want. The scratch file can not be on the
> system that is being checked and that seems like it will try to open a
> scratch file when checking the root file system using the root
> filesystem, which would be a bad idea.
No. That line is correct. The temporary file is opened and used when
needed. The root file system does not require a temporary file.
If you were to look at /etc/rc you'll that this is exactly what it does.
With the following comment:
echo Automatic reboot in progress... >/dev/console 2>&1
date >/dev/console 2>&1
# this will *only* work if fsck can do your root file system
# without a temporary file, and if the root file system is
# checked alone in a pass by itself -- be careful! This can
# *seriously* mess you up.
fsck -p -t /_FSCK_TMP_FILE >/dev/console 2>&1
case $? in
So people should not create very large root systems, and in /etc/fstab,
the root file system should be checked first, and alone. Which is the
case by default, but people should be aware, so that they don't get
creative.
> I'm doing this by memory (which for an old guy can be dangerous - as I
> do not have 2.11 running on a system, only V7). But I believe you want:
> fsck -p1 on a separate line checking the return code. If it comes back
> clean then run:**fsck -p2-4 -t /tmp/scratch_file again checking the
> return code, if all is good go to multi-user. The key is the root file
> system should be small enough for the tables to fit in memory and thus
> fsck can be run without a scratch file. When you run it on the larger
> partitions that need the scratch file, it will be placed in the/tmp
> directory on the root filesystem and you should be fine.
You could, but just -p -t /foo is enough. fsck do handle things the
right way here.
If fsck needs to modify the root file system, it will not run through
the other ones, but will instead finish at that point, and you need to
reboot. And the reboot needs to be without a sync.
Johnny