Mounting U and X drives automatically on Linux at boot-time

This requires the user to have sudo access, and be comfortable with using the Linux command line and some minor editing of system files.

It's not really suitable for WiFi-connected devices, as any network offline-time or switch to a different hotspot may cause the shares to lock up and necessitate a reboot. Use for ethernet-connected desktops only. Also, it's not suitable for shared computers; only if you are the sole user.

First it's necessary to install some extra package to allow mounting of network shares onto the local filesystem:

sudo apt install cifs-utils

Create some mountpoints in your home directory:

mkdir $HOME/U-drive
mkdir $HOME/X-drive

Make a file to hold your University credentials for accessing the shares drives:

nano $HOME/smbcredentials

Populate that file with your username, password and domain like this (replacing the x's with your own details!):

username=ac1xxx
password=xxxxxxxx
domain=SHEFUNIAD

Lock down the permissions:

chmod 600 $HOME/smbcredentials

To tell the system to mount these at boot-time, it's necessary to edit the file system mounts table. Before doing this, find out your uid and gid values, using the “id” command.
Also, if you haven't done so already, find out the path to the particular server your U-drive is located on, here:
https://www.sheffield.ac.uk/it-services/password/crisp-web.pl
(see the section “View University Storage Information”and look in the “Server” field)

Then edit:

sudoedit /etc/fstab

Using the information you gathered in the last step, add these entries to the file:

//stfdataXX.shef.ac.uk/home/Ac/Ac1XXX	/home/<your_username>/U-drive	cifs	uid=xxxx,gid=xxxx,credentials=/home/<your_username>/smbcredentials	0	0
//uosfstore.shef.ac.uk/shared	/home/<your_username>/X-drive	cifs	uid=xxxx,gid=xxxx,credentials=/home/your_username/smbcredentials	0	0

The above is generic, so you need to replace:

  • stfdataXX with your storage server,
  • Ac1xxx with your ITS username,
  • the uid and gid with your own, so it the shares can be mounted in your home directory,
  • and <your_username> with your local username on your PC

One this is set up, reboot, log in, and the U and X drives should be available in your home directory.

Alternative: easy mounting but not automatically

You may prefer to not have the U and X drives mounted at boot time, but still have easy access to them. In this case, in the mount options in fstab, prefix the uid=xxx with “noauto”, so it would look like this:

//stfdataXX.shef.ac.uk/home/Ac/Ac1XXX	/home/<your_username>/U-drive	cifs	noauto,uid=xxxx,gid=xxxx,credentials=/home/<your_username>/smbcredentials	0	0
//uosfstore.shef.ac.uk/shared	/home/<your_username>/X-drive	cifs	noauto,uid=xxxx,gid=xxxx,credentials=/home/<your_username>/smbcredentials	0	0

Then, when you do want to mount them, use this command:

sudo mount /home/<your_username>/U-drive
sudo mount /home/<your_username>/X-drive

To unmount, do this:

sudo umount /home/<your_username>/U-drive
sudo umount /home/<your_username>/X-drive
mounting_university_drives_on_linux_at_boot-time.txt · Last modified: 2024/07/25 14:45 by ac1mde
Public Domain
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0