A better mountall

Bug #614662 reported by Gerald Villemure
58
This bug affects 9 people
Affects Status Importance Assigned to Milestone
mountall (Ubuntu)
Invalid
Undecided
Unassigned
Nominated for Maverick by Gerald Villemure

Bug Description

Binary package hint: mountall

The current implementation of mountall in Lucid is rather dangerous if you don't have console access.

It will effectively hang your boot process if anything goes wrong. (MD did not get assembled, data drive is offline, etc.) If you don’t have console access to press "s", your out of luck.

For those like me that administer their server remotely the historic solution was to ensure serial console access. But even then, you don’t see anything when connecting, so you can press "s" and HOPE for the best.

There is another issue here, the fundamental idea that a system is an all or nothing solution. Why is it that the data drive needs to be online and mounted BEFORE I can get SSH access? I have systems that run both Asterisk and Samba and I find it inappropriate that Asterisk needs to WAIT for Samba’s Data drive to get online before Asterisk can start. We need a SMARTER start process that is NOT all or nothing, it is OKAY to mount some filesystems later when they are ready, and not hold up the whole system.

I wrote a small script called "mountall2" which mounts the non-root filesystems later in the boot process (last actually) and does so in a way that make diagnostics and recovery POSSIBLE.

Every filesystem is FSCK and MOUNTED just like mountall but it is done in parallel and inside a "screen" session. If you have console you can check the FSCK progress on TTY13+ by pressing <RIGHTALT>+<F1> etc. But if you don’t have physical access to the machine you can SSH into the box and use "screen –x .." to see the FSCK progress.

The script will also call postmount scripts if present since there are times where you will need to notify NFS or some other app that the filesystem is now online. Ideally upstart scripts could be predicated on a filesystem being available and auto start the task when the FS come online.

To use, untar the script somewhere like /usr/local and add this line to /etc/rc.local:
  /usr/local/mountall2/mountall2 &
Then edit your /etc/fstab to add the noauto options and set the FSCK field to a 3
Original setup:
  UUID=b97af687-8a45-4197-89d4-fb62b4feb0d1 /boot ext4 defaults 0 2
New setup:
  UUID=b97af687-8a45-4197-89d4-fb62b4feb0d1 /boot ext4 defaults,noauto 0 3

The "noauto" option will prevent the native "mountall" from touching the entry. The FSCK check of 3 is a simple way of saying it should be check at the end of the system boot sequence.

The postmount scripts need to have the same name as the mount point with the / converted to underscores _, so if your mount point is "/mnt/test" then create a file "postmount/_mnt_test" script with your commands. There is a sample "postmount/_Media" in the tar file.

Hopefully something of similar functionality will become integrated into the distro.

Gérald

Tags: patch
Revision history for this message
Gerald Villemure (gvillemure) wrote :

Here is an updated version of mountall2 which does a better job of respecting mount hierarchies.

description: updated
Revision history for this message
Erik Reuter (misc71) wrote :

Very nice! Since Scott Remnant has not been responding to bugs with mountall (eg. Bug #571444) I hope that your solution is used in a future Ubuntu release.

Revision history for this message
Ofer Chen (oferchen) wrote :

Thank you, I was looking for something that doesn't need constant attention ;)

Revision history for this message
Fionn (fbe) wrote :

See also: bug #638228

Changed in mountall (Ubuntu):
status: New → Confirmed
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "mountall2.tar.gz" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Steve Langasek (vorlon) wrote :

This bug report seems to have been based on a lack of understanding of the available mountall options. The only filesystems that will block the start of services like ssh are those mounted at standard FHS mount points. If you have a filesystem mounted at one of the standard mount points and you don't want the boot to wait for that one either, you can use either 'nobootwait' or 'timeout' options for it in /etc/fstab to express this.

Closing this report as invalid since I don't see anything here that requires mountall changes.

Changed in mountall (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Gerald Villemure (gvillemure) wrote :

The point of the mountall2 script was to introduce the idea of a more intelligent booting process, with pre and post mount hooks and the ability to check the progress of the FSCK remotely.

I shied away from using the nobootwait option because I needed a postmount script to restart some services once the filesystem gets online.

If the original mountall generates UPSTART events, then I supposed it is possible to trigger a post-mount script that way.

Gérald

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 614662] Re: A better mountall

On Sat, May 19, 2012 at 08:04:34AM -0000, Gerald Villemure wrote:
> If the original mountall generates UPSTART events, then I supposed it is
> possible to trigger a post-mount script that way.

It certainly does and always has - there are 'mounting' and 'mounted' events
for each filesystem mount, which you can find example usage of on a stock
Ubuntu system in /etc/init/.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.