Troubleshooting problems that arise when mounting devices

Ubuntu normally recognises your hard drives correctly and "mounts" them so that they are accessible to you from the file manager. It also normally recognises and mounts any extra devices that you may plug in via a USB port, such as a flash thumb-drive, a digital camera, an audio player, or an external hard drive.

However, there is the occasional hiccup which needs to be dealt with. You will need to open up a command-line terminal and input commands to resolve the situation, perhaps with the aid of helpful people on the Ubuntu forums.

N.B.: On Linux, the hash sign ("#") denotes a comment. What follows the "#" is not part of the command, so you don't have to type it, although nothing bad will happen if you do.

Getting information about your devices

There are a few commands that can gather information about your storage devices.

sudo fdisk -l

That is a commonly-used one. It focuses on where drives are and the size of the partitions.

sudo blkid

That one focuses on how things are identified.

sudo lshw -C disk

That gives a large amount of info on your hardware. Take off the -C disk part if you want info on other devices, such as your video card and motherboard, as well.

If you go to the Ubuntu forums for help with a mounting issue, the first thing they will do is ask you to type in one of those commands and give them the output. So, you might as well start armed with that info, to save time.

The filesystem table file

There is a text file on your computer containing a table which states what devices you have and specifies how and where there are to be mounted. This file is located at /etc/fstab.

To print the contents of that file out on to the terminal, use the following command:

cat /etc/fstab

This allows you to see what is in the file. It is useful because you can then copy it and paste it into a discussion on the Ubuntu help forums, or an e-mail to a helper.

Understanding the file

The file located at /etc/fstab normally contains many lines beginning with the hash sign ("#"). These are all just comments, there to provide you with information. They are not important, and deleting them will have no effect.

Turn your attention to the lines without "#". They each contain information separated by spaces. The number of spaces does not make any difference. Take the following line, for example:

LABEL=Files  /home/fred      ext3    defaults        0       2

The first bit of information is the thing we want to mount. The second bit of information is the "mount point", or where we want the thing to be accessible. The third bit of information is the type of filesystem on the device. The fourth bit of information is the options we want to specify. The fifth and sixth bits of information are numbers relating to error checks.

For further information, consult the article on fstab. Alternatively, type man fstab on the command line.

Different ways of referring to a device or partition

You may notice that there are three ways in which you can refer to a device or partition.

  • /dev/
  • LABEL=
  • UUID=


The first way is the standard way. Each storage device on your system gets an identifier such as "hda" ("Hard Drive A") or "sda" ("SATA drive A"). The partitions on these devices then get numbers. So, you might have things like /dev/hda1 or /dev/sdb5. These names are a little bit deceptive, because locations that start with "/" are normally files and directories that you can visit in your file manager. The stuff in /dev/ is a bit special, because you can't just go to /dev/hda2 and expect to see files inside it. You have to mount it somewhere first, just like something identified with LABEL= and UUID=.

The disadvantage of referring to thing with /dev/ identifiers is that the numbers and letters may change as devices change. For example, creating a new partition on /dev/sda may mean that a partition previous identified as /dev/sda4 is now /dev/sda5. If you are suddenly unable to mount something, then this may be why.

The advantage is that they are meaningful: you can immediately see that /dev/sdb1 and /dev/sdb2 are partitions on the same hard drive.


You can decide to give any partition on your system a volume label. This is simply a name that you choose. By default, partitions generally don't have volume labels. For a guide to volume labels, consult RenameUSBDrive. Don't be put off by the title — it is not only for USB drives.

To see what labels your drives have, just type sudo blkid on the command line. To narrow it down, you can try stuff like sudo blkid | grep LABEL or sudo blkid | grep sda if you like.

Once you know what the label is, you can use it instead of the /dev/ reference. For example, in your /etc/fstab file, you might put LABEL=Ubuntu instead of /dev/sda1.

The advantage of labels is that they are immediately meaningful to you (because you chose the name). They also remain exactly the same for ever, unless you format them or decide to change the name again. Another great advantage is that devices with a label will automount with that label; so, if LABEL=MyMusic, it will be automounted at /media/MyMusic.

The disadvantage is that they provide no other info.

You should generally try to refer to your devices using volume labels where possible.


The UUID of a partition is just like the volume label, except you can't choose it. It remains the same, despite changes to the devices around it. It is therefore quite reliable, and works without the user having to decide on a name. All partitions automatically have a UUID. Its main disadvantage is that it's just a meaningless string of characters, e.g. "6223d2bf-822b-4a42-a15e-05b17b7f3aef".

To see what UUIDs your drives have, just type sudo blkid on the command line. To narrow it down, you can try stuff like sudo blkid | grep UUID or sudo blkid | grep sda if you like.

Opening an editor

If you need to alter something in the file, you will need to open it in an editor. They are many available. Try one now.

sudo nano /etc/fstab         # This will edit the file within the terminal.  Press      
                             # Ctrl + X to close it.
gksudo gedit /etc/fstab      # This will open it up with Ubuntu's default GNOME editor
gksudo mousepad /etc/fstab   # This will open it up with Xubuntu's default Xfce editor 
kdesudo kwrite /etc/fstab    # This will open it up with Kubuntu's default KDE editor

The sudo part is to run the command with what we call "superuser" or "root" privileges. This is necessary because users just own their directory located in /home. All other locations (including everything within /etc) belongs to "root", and will be read-only (or sometimes not even readable) to the you, the user, until you give yourself extra powers with this command. For programs that open their own window, we use gksudo or kdesudo instead.

Correcting the file

So now you have an idea of what the stuff in the file means, and you know how to edit it. You should be able to compare what you know about your hardware with what you see in the file. For example, you may know that you have one partition formatted as ext2, and the sudo blkid command may show you that this device is identifiable as "/dev/sdb7", with the UUID "6223d2bf-822b-4a42-a15e-05b17b7f3aef" and the label "fredsmovies".

Let's say that this device is not mounting properly. If you look in /etc/fstab as see that there is a line like this:

UUID=b79352456e77  /mnt/fredsmovies      ext2    defaults        0       2

...then you will immediately see the problem. For some reason, the UUID is wrong. So, you just fix that, save the file, and exit.

MountDevicesTroubleshooting (last edited 2009-02-17 13:39:27 by AAnnecy-257-1-108-212)