OT: How do I Automount an Hard dRive in my Computer in Ubuntu?

Ralf Mardorf silver.bullet at zoho.com
Sun Nov 29 14:53:10 UTC 2015


Off-topic

On Sun, 29 Nov 2015 13:21:43 +0200, Tom H wrote:
>On Sun, Nov 29, 2015 at 8:17 AM, Ralf Mardorf <silver.bullet at zoho.com>
>wrote:
>>
>> - If you want to mount devices at startup use fstab, do not use
>> desktop environment related apps.  
>
>If you're using systemd as pid 1, you can create a mount unit.
>
>An example from a test VM:
>
>[Unit]
>Before=local-fs.target
>
>[Mount]
>What=/dev/disk/by-uuid/f72ce78b-216e-4cfc-ae49-8afc8d6160f2
>Where=/opt
>Type=ext4
>Options=relatime

Interesting :), but not helpful for the OP and other newbies.

This perhaps require to read
http://www.freedesktop.org/software/systemd/man/systemd.automount.html
and
http://www.freedesktop.org/software/systemd/man/systemd.mount.html
much more than a help page how to use fstab, including how to get the
UUID.
You need to take a look at
http://man7.org/linux/man-pages/man8/mount.8.html too.

How is fsck handled, when using a unit?

Perhaps it's most secure to edit /etc/fstab and then to make a systemd
unit using
http://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html
:D.

If not using systemd, but upstart or sysvinit, it's possible to mount
by a script.

systemd isn't part of all Ubuntu releases, while fstab is part of quasi
all UNIXlike systems.

FWIW, beside the very short, but useful Ubuntu help (the link was
provided more than once) and the man page, there are examples available
by util-linux, wich is available for all supported Ubuntu releases.

$ cat /usr/share/doc/util-linux/examples/fstab
$ cat /usr/share/doc/util-linux/examples/fstab.example2

There are likely more subscribers able to help the OP, assumed there
should be issues with fstab, then regarding issues with
gnome-whatsoever or systemd unites to mount a device at startup.

  Remember the original request is:

  Date: Tue, 24 Nov 2015 15:20:29 -0800
  From: keith_linux at comcast.net
  To: ubuntu-users at lists.ubuntu.com
  Subject: How do I Automount an Hard dRive in my Computer in Ubuntu?


  I have a second HDD in my computer that I want to automount when I
  start the system. How do I accomplish this in Ubuntu?

(Oops, "in the computer", I asked if it might be an external drive.)

The universal and only correct reply is to use fstab. It doesn't matter
what release of Ubuntu is used, it's easy to understand, at least with
help from the mailing list and beyond that basic knowledge you should
learn, when using Ubuntu or any other distro.

A systemd unit works too, gnome-whatsoever works too, but they aren't
exactly the ideal solutions.

Regards,
Ralf




More information about the ubuntu-users mailing list