Results 1 to 7 of 7

Thread: Running a command in the middle of reading fstab on boot?

  1. #1
    Join Date
    Mar 2010
    Location
    Ohio
    Beans
    465
    Distro
    Kubuntu

    Running a command in the middle of reading fstab on boot?

    Is there a way to set a command to be run at a specific part of the boot process, such as right in the middle of mounting drives in the fstab, and have mounting paused until the command returns a 0 exit value?

  2. #2
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Running a command in the middle of reading fstab on boot?

    I doubt if you can stop fstab in the middle as it is just one command mount that loads it.

    But you could remove mounts from fstab if not the main system and load them with a script.

    Startup script is:
    /etc/rc.local
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  3. #3
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: Running a command in the middle of reading fstab on boot?

    If you can let us know exactly what it is you're trying to achieve then there are probably other solutions. As oldfred mentioned above it isn't possible to run a command in the middle of mounting the contents of your fstab.
    Cheesemill

  4. #4
    Join Date
    Mar 2010
    Location
    Ohio
    Beans
    465
    Distro
    Kubuntu

    Re: Running a command in the middle of reading fstab on boot?

    My use case is that I have two drives, an SSD as /dev/sda, and a hard drive as /dev/sdb. /dev/sda is currently encrypted, and serves /boot and /. /dev/sdb is also encrypted, and provides /home. there is a key file for /dev/sdb in /root, so I unlocked /dev/sda with a password and /dev/sdb automatically unlocks thereafter.

    I'm planning on removing the encryption on /dev/sda when I upgrade here shortly, but I'm trying not to use a password for /dev/sdb. So I've got the idea to keep the key file on my Ironkey, which requires mounting /dev/sr0, running the unlocker, then mounting the now available /dev/sdc, and thereafter mounting the decrypted side of /dev/sdb to /home. (all of this, prior to login, of course)

  5. #5
    Join Date
    Mar 2010
    Location
    Ohio
    Beans
    465
    Distro
    Kubuntu

    Re: Running a command in the middle of reading fstab on boot?

    Another thought occurs, is it possible to have a script run exactly after the fstab is handled, and before anything else?

    I could set /dev/sdb and /dev/sdc to 'noauto', and just mount them in a script afterwards.

  6. #6
    Join Date
    Mar 2010
    Location
    Ohio
    Beans
    465
    Distro
    Kubuntu

    Re: Running a command in the middle of reading fstab on boot?

    Bump to see if the last question can be answered.

  7. #7
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    upstart

    You might take a look in /etc/init/mountall.conf to see if that is what mounts everything. If so, you could have it trigger your script.

    http://upstart.ubuntu.com/cookbook/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •