AutoFsckspec

Differences between revisions 8 and 9
Revision 8 as of 2007-05-07 12:38:01
Size: 8640
Editor: 64-73-235-34
Comment: Add suggestions to AutoFsckspec
Revision 9 as of 2007-05-07 13:39:28
Size: 8990
Editor: pat-97
Comment:
Deletions are marked like this. Additions are marked like this.
Line 81: Line 81:
 * Problem with "Restarting" is that Users may have set a hard drive password. This means that the system will not restart (without user intervention) and probably shut down after some minutes, without having checked the file system. I think a way should be found to run fsck while shutting down, rather than during boot-up. --["AndreasSchildbach"]

Introduction

This is not the main AutoFsck page, that is at the page AutoFsck. This page is the spec which is linked to by the Launchpad blueprint. If you wish to see end user information, or download and use AutoFsck, please visit the main page.

About

AutoFsck a script which automates periodic disk checking in such a way that it no longer bothers the user every 30 boots, and is streamlined in a friendly graphical user interface.

AutoFsck ensures that the automatic disk check will no longer inconvenience you by making your boot times very long.

Rationale

The automatic 30 mount fsck is time consuming, but needed. The problem is that the user never knows how close they are to hitting the 30 mounts, so the long boot delay may come at a very inconvenient time.

Use Cases

Peter doesn't know that he has not run fsck for a while. He has prepared a presentation with Open Office and just turned on his laptop to show it. Peter boots up quickly, gives his presentation and then starts to shut down his laptop. At this point he is told that his disks are signalling that they need checking and asked if he would like it to run the checks when he shuts down. He knows he isn't in a rush so he says yes. His laptop runs fsck and then powers down.

Jane is a student who runs Ubuntu on her laptop. She is late for a lecture and needs to get up and running quickly. AutoFsck makes sure that fsck isn't run on boot. When she shuts down after the lacture she is asked if she would like to run fsck, she is rushing off to the next lecture and so doesn't have time to wait, she selects no. When she shuts down after the next lecture she is prompted again, again she is in a rush and selects no. After using her laptop in the evening, she is prompted a third time, and knowing that she has nowhere urgent to go, says yes. Her laptop runs fsck and powers down.

Melanie runs Ubuntu on her desktop. She needs to quickly copy a file to her USB drive to take to University with her. She copies the file and clicks 'shut down'. She is asked if she wants the computer to run fsck, knowing that she is leaving the house and doesn't need it any more, she says yes, as she leaves it is running fsck and shutting down.

NOTE: The prompt will not refer to fsck, but to checking disks for errors, or something equally user friendly.

Inclusion in Ubuntu

From the activity on the forums regarding the annoyance of the forced disk checks, I feel that AutoFsck, or at least something with it's functionality should be included in the main Ubuntu Distribution as a dependency of Ubuntu-Desktop (as it is of dubious use on the server etc).

The project aim is to include AutoFsck in Gusty Gibbon (7.10)

Technical Details

AutoFsck.tar.gz contains four files:

We can discount readme and install, and focus on the others.

AutoFsck is copied to /etc/X11/gdm/PostSession/AutoFsck and is called by Default, which is copied to /etc/X11/gdm/PostSession/Default. The reason for Default calling AutoFsck is that people may wish to include other commands in Default - indeed, Ubuntu has some commands in there by default.

Default is called (as root) by gdm after the user closes her session, the mount count and maximum mount count values from tune2fs -l are evaluated, and if disk checks are not imminent, the script exits. If disk checks are required, or will be next boot, the script uses zenity to ask the user if she wants to schedule disk checks to occur at shutdown.

If the user says no, the script issues the command: touch /fastboot which will prevent disk checks on the next boot, the script then exits.

If the user says yes, the script issues the command: touch /forcefsck which will force disk checks on the next boot, it then creates another script which will cause the system to restart rather than shut down (when commanded to do so), and yet another script which causes the computer to shut down immediately after booting.

The upshot of this is that when the user shuts down her computer, the following takes place.

  • System starts to shut down, moves to the appropriate init level and runs scripts
  • First generated script is run, it removes itself and sends the system to init 6 - restart
  • The system restarts, and because of /forcefsck it checks the disks
  • When it reaches the appropriate init level it executes the second generated script which sends the system to init 0 - halt, and then removes itself.
  • The system halts.

All checks are done and the system is powered down.

There are some bits of tidying up which I haven't outlined here.

Feedback, Suggestions, Comments etc

If you have any feedback, suggestions or comments, please post them below or email me; jmusther@gmail.com

Feedback/Discussion

  • I'm looking for somebody to create an AutoFsck.deb for Ubuntu, if there are any takers, please email me.

  • I leave my laptop & desktop on for days or weeks, so I don't know at boot-time whether I will have time for 'fsck' at the next reboot or not. A dialog (even if it's a console dialog) that allows deferring 'fsck' at every boot sounds more like the correct solution to me... -- JanClaeys

    • I've seen this proposed somewhere else (I'm sorry I can't remember where), but the problem is that many users don't see the need for running fsck, and would skip it every time. I've lost count of the number of times I've called to work on a windows desktop with a really messed up filesystem because the user keeps cancelling the boot time scandisk. I appreciate your situation and understand why the AutoFsck implementation isn't right for you, but I'm not sure what would be the best alternative. I don't think many users want to wait at boot time. I wonder if it's possible to move the fsck to be done on shutdown and then have an option to cancel it. So in the dialogue which allows you to select Shutdown, Suspend etc, there's a little note when you're due for an fsck which says 'When you shut down your filesystem will be checked for errors, if this is not a convenient time, click the 'fast shutdown' button'. The 'fast shutdown' button would only need to be available when a disk check is due.

    • Don't call it 'fast shutdown' because everybody like 'fast' and some people will use this option without reading the warning Smile :) I would suggest something like 'Postpone disk check', it's more technical but that's fine - if you don't understand what it is about you should just choose the normal Shutdown and have the disks checked. --TormodVolden

  • Two potential problems: 1, I suspect a user may be able to change the number of boots before fsck kicks in, e.g. 100. AutoFsck needs to know about this not asking the user to Fsck after 25 boots when it has been set to fsck at every 100 boots. 2, What if a user selects no all the time and rebooted 5 times? Will s/he be forced to wait for fsck?

  • AutoFsck should check to see if the laptop is on battery, and if so, assume that the check should *not* happen on shutdown. Fsck already has logic to check to see if it is on battery on bootup, and to skip the fsck unless the fsck parameters have been exceeded by a gross amount. --["TheodoreYTsO"]

  • On a someone related note, if the system has the ability to do on-line snapshots using devicemapper, the really right answer is to have a configurable option where a cron script checks to make sure the machine is connected to the AC mains (feel free to steal code from e2fsck for checking for this) and if so, creates an on-line snapshot of the filesystem, and then runs e2fsck -nf on the snapshot. If the filesystem is clean, then tune2fs can be used to adjust the last-checked and number-of-mounts-since-last-checked parameters on the live filesystem. If the filesystem contains errors, the e-mail should be sent to the system administrator(s) so that they can schedule downtime to fix the filesystem with errors. (Optionally, upon configuration the system could be immediately halted or rebooted to force an fsck, depending on the whether the system administrators has some kind of high-availability failover set up for the system, or if the system contains critical applications where it is better to force a reboot and fsck right away, rather than to let the system continue with a partially corrupted filesystem.) --["TheodoreYTsO"]
  • Problem with "Restarting" is that Users may have set a hard drive password. This means that the system will not restart (without user intervention) and probably shut down after some minutes, without having checked the file system. I think a way should be found to run fsck while shutting down, rather than during boot-up. --["AndreasSchildbach"]

AutoFsckspec (last edited 2008-08-06 17:00:43 by localhost)