Auto-mounting partitions and Fstab

Here I mentioned about the Work and Storage partitions I use. And in here I went through how to set them up during the installation of a distro.

In this article I tell how these mount-points can be made and auto-mounted if the distro is already installed and also a little bit about the File Systems Table or Fstab.

In this article I go through how to make the /work and /storage partitions if the distro is already installed

Auto-mounting partitions

Before any partition can be used, it needs to be mounted. When you log into your distro, at least your system (or root) partition ( / ) will be automatically mounted. It is handy to auto-mount some other partitions as well, like the one that has Dropbox on it, because the Dropbox-application that launches at startup will be looking for the Dropbox folder right after you log in. Steam is another example, if you have your games on another partition and you want it to be auto-mounted. I can write another article about this later if needed.

So far in my experience the best application for auto-mounting partitions has been gnome-disk-utility (called Disks or gnome-disks in some systems). With this it’s easy to:

  • Add mount-points for partitions (like /work)
  • Make partitions to auto-mount on startup
  • Make some of the partitions invisible in the user interface, which clears up the clutter nicely in file managers, for example

Another, less popular graphical disk mount-point manager is pysdm.

gnome-disk-utility or gnome-disks

If you add mount-points for partitions (like /work), you may need to first create that folder (can’t remember if I did it or not). Do it by so in Terminal:

# Creating a folder for the /work mount-point:
sudo mkdir /work

If you can’t create files or folders to the root of /work, you need to give your user some rights to do that:

# Adding user rights for user mj for the /work mount-point:
sudo chown mj /work

File Systems Table or Fstab

All this info about what partitions get mounted on system boot and which of them are visible in the user interface is gathered into the file called fstab (file systems table), located inside the folder /etc in your system. If you mess something up in the gnome-disk-utility, you can try to fix the mistakes in its GUI or you can try to peek inside the fstab file via the terminal and remove some random lines (may cause your system not to boot anymore, be careful):

# Open fstab file in the Nano text editor with root privileges:
sudo nano /etc/fstab

Delete the last lines that seem right, close and save (ctrl+X, Y, enter) the file, restart the computer and start over.

Once my fstab was a bit messed up (I wonder why… :P), that really made the GUI programs like gnome-disk-utility to not work well. It was easily fixed by removing some of those extra lines.

Here is an image of my fstab file:

Here it is again with some comments:

Auto-mounting network locations

If you’re working on a collaborative network environment, it would make sense to mount some network locations to /shared and /render, for example. I haven’t done this myself yet, but I think it should be relatively easy to find instructions on how to do this. When I need to do this myself, I will update this article and write some instructions here.