AutoFsckspec
Size: 5323
Comment:
|
Size: 8181
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
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. | This is not the main AutoFsck page, that is at the page AutoFsck. This page is the spec which is linked to by the [https://blueprints.launchpad.net/ubuntu/+spec/prompt-for-fsck-on-shutdown Launchpad blueprint]. If you wish to see end user information, or download and use AutoFsck, please visit the main page. |
Line 8: | Line 8: |
AutoFsck is a set of scripts which automate 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 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. |
Line 18: | Line 18: |
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. When peter logs in, he is told that he has not run fsck in 25 boots and asked if he would like it to run when he shuts down his laptop. He knows he isn't in a rush after the presentation so he says yes. When peter shuts down his laptop later, it runs fsck and then powers down. | 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. |
Line 20: | Line 20: |
Jane is a student who runs Ubuntu on her laptop. She is late for a lecture and needs to get up and running quickly. When she logs in she is asked if she would like to run fsck when she shuts down, she will be rushing off to the next lecture and so wont have time to wait, she selects no. When she boots up her laptop for the next lecture she is prompted again, again she is in a rush and selects no. When she boots up her laptop in the evening, she is prompted a third time, and knowing that she has nowhere urgent to go later, says yes. When she shuts down her computer for the evening it runs fsck and 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. |
Line 22: | Line 22: |
Melanie runs Ubuntu on her desktop. She needs to quickly copy a file to her USB drive to take to University with her, when she logs in she is asked if she wants the computer to run fsck when it shuts down, knowing that she is leaving the house and doesn't need it, she says yes. She copies the file and then shuts down the computer, as she leaves it is running fsck and shutting 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. |
Line 34: | Line 34: |
[http://musther.googlepages.com/AutoFsck.tar.gz AutoFsck.tar.gz] contains five files: * AutoFsck * Default * install * mountcount * readme |
AutoFsck is copied to /etc/X11/gdm/PostSession/AutoFsck and is called by Default, which is copied to /etc/X11/gdm/PostSession/Default. |
Line 41: | Line 36: |
We can discount readme and install, and focus on the others. | 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 at the next boot, the script uses zenity to ask the user if she wants to schedule disk checks to occur at shutdow At this point, as of v2.5, there is an audio prompt - a short musical scale (ascending C blues) - to make sure the user doesn't miss the prompt, say by turning off the monitor very soon after calling shutdown. The audio is provided through the PC speaker, courtesy of 'beep'. |
Line 43: | Line 38: |
mountcount is copied to /etc/init.d/mountcount.sh and called by init every time the system boots, it increments a file (/usr/share/mountcount) by 1 ever time. AutoFsck is copied to /etc/X11/gdm/PostLogin/AutoFsck and is called by Default, which is copied to /etc/X11/gdm/PostLogin/Default. The reason for Default calling AutoFsck is that people may wish to include other commands in Default. Default is called (as root) by gdm after a successful login and before the session is started, the content of /usr/share/mountcount is evaluated, and if below 25, the script exits. If the value is 25, 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: |
If the user declines, the script issues the command: |
Line 54: | Line 42: |
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. At this time /usr/share/mountcount is also reset to 0. |
If the user says yes, the script creates a new script /etc/rc0.d/S89autofsck. This script is called after all other shutdown scripts except S90halt. S89autofsck simply remounts / read only, and then runs fsck on all filesystems before remounting read write and removing itself, it then exits and allows shutdown to continue. |
Line 59: | Line 45: |
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. |
I made the decision to run fsck on all filesystems rather than treating them individually after much discussion with users as I came to the conclusion that it better suits the desktop user (as this is the group AutoFsck is aimed at). |
Line 66: | Line 47: |
All checks are done and the system is powered down. The cycle is ready to continue again. | There are some bits of tidying up which I haven't outlined here. |
Line 72: | Line 53: |
=== Feedback/Descussion === | === Feedback/Discussion === |
Line 74: | Line 55: |
* I'm looking for somebody to create an AutoFsck.deb for Ubuntu, if there are any takers, please email me. | '''PLEASE NOTE -''' I have removed all comments which made suggestions which have been implemented in 2.0 and 2.5. Similarly, I have removed all comments which are no longer relevant or no longer make sense. * 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 :) 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 * 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"] * I'd suggest not creating the /fastboot file. If the check was interrupted for some reason then we do still want to check the filesystems. On the other hand if the check completed ok, then the builtin e2fs metadata should be enough to skip the check next time. There is one remaining window here which is when more than 180 days elapse between shutdown and next bootup, but in that case it's probably reasonable to check. -- ["MartinPool"] * I think that should be selectable if the check happens on startup or shutdown. Personally, I prefer at startup, for instance. ["AdilsonOliveira"] * Seriously: why can't we just disable the forced fsck every x mounts? Ext is the only filesystem I know of that does this. Windows doesn't do it for fat or ntfs. Reiserfs does not do it. Why does ext still do it? It simply isn't needed in the vast majority of cases, so why inconvinience the user with it? -- ["PhillipSusi"] |
ContentsBRTableOfContents |
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 [https://blueprints.launchpad.net/ubuntu/+spec/prompt-for-fsck-on-shutdown 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 is copied to /etc/X11/gdm/PostSession/AutoFsck and is called by Default, which is copied to /etc/X11/gdm/PostSession/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 at the next boot, the script uses zenity to ask the user if she wants to schedule disk checks to occur at shutdow At this point, as of v2.5, there is an audio prompt - a short musical scale (ascending C blues) - to make sure the user doesn't miss the prompt, say by turning off the monitor very soon after calling shutdown. The audio is provided through the PC speaker, courtesy of 'beep'.
If the user declines, 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 creates a new script /etc/rc0.d/S89autofsck. This script is called after all other shutdown scripts except S90halt. S89autofsck simply remounts / read only, and then runs fsck on all filesystems before remounting read write and removing itself, it then exits and allows shutdown to continue.
I made the decision to run fsck on all filesystems rather than treating them individually after much discussion with users as I came to the conclusion that it better suits the desktop user (as this is the group AutoFsck is aimed at).
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
PLEASE NOTE - I have removed all comments which made suggestions which have been implemented in 2.0 and 2.5. Similarly, I have removed all comments which are no longer relevant or no longer make sense.
- 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
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
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"]
I'd suggest not creating the /fastboot file. If the check was interrupted for some reason then we do still want to check the filesystems. On the other hand if the check completed ok, then the builtin e2fs metadata should be enough to skip the check next time. There is one remaining window here which is when more than 180 days elapse between shutdown and next bootup, but in that case it's probably reasonable to check. -- ["MartinPool"]
I think that should be selectable if the check happens on startup or shutdown. Personally, I prefer at startup, for instance. ["AdilsonOliveira"]
Seriously: why can't we just disable the forced fsck every x mounts? Ext is the only filesystem I know of that does this. Windows doesn't do it for fat or ntfs. Reiserfs does not do it. Why does ext still do it? It simply isn't needed in the vast majority of cases, so why inconvinience the user with it? -- ["PhillipSusi"]
AutoFsckspec (last edited 2008-08-06 17:00:43 by localhost)