Le Tuesday 09 December 2014 16:36:53, The Wanderer a écrit :
On 12/09/2014 at 10:09 AM, Chris Bannister wrote:
On Tue, Dec 09, 2014 at 09:48:58AM +0100, Frédéric Marchal wrote:
Now, is it possible to run fsck during shutdown? Users have been
asking for this for at least 10 years. Is it now acceptable,
possible, tolerated?
That sounds like a recipe for disaster. Do you mean *before*
shutdown?
Obviously, "during shutdown" means "during the shutdown process", i.e.,
during the sequence of shutting-down-the-system steps which takes place
in response to a "shutdown" command.
That sequence already does several things prior to actually shutting
down the system; perhaps most obviously, it tells various "services" to
stop cleanly, kills other processes, and unmounts filesystems. There
seems as if there should be no conceptual reason why it shouldn't be
possible to add an additional "run a fsck" step into that sequence,
probably after the unmount and before the final shutdown itself.
...except that fsck of root during the boot process is possible only
because root hasn't been mounted yet, because we're still in the
initramfs and haven't pivoted into the real root yet. So making that
possible during shutdown would probably require setting up another
ramdisk during the shutdown process (which sounds like a bad idea),
pivoting into it, unmounting the original root, and then triggering the
fsck...
The partition only need to be remounted read only. if I'm understanding it
correctly.
That's what /etc/init.d/umountroot does during the shutdown sequence. So
everything is in place to run fsck just before /etc/rc0.d/K10halt.
Now two questions remain:
1) how to invoke an additional hypothetical /etc/rc0.d/K10fsck on demand?
2) is it wise to run fsck at that time? I have seen strong opposition in the
past. Mostly turning around the risk that the user would switch the power off
or the power supply would fail resulting in a damaged partition. As the risk
seems as high during the boot sequence, I don't understand the opposition.
All in all, while it *might* be possible, I don't think it sounds like
that would be worth the trouble.
That's probably right too...
Frederic