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.
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.
So, we can see here that there is something (a hard drive partition, in fact) which bears the label "Files". The /etc/fstab file is telling Ubuntu to mount this at "/home/fred", which means that if Fred goes to that directory in his file manager, he'll see the contents of that partition. We can also see that the partition is formatted as ext3 (the default Linux filesystem), and that no special options have been specified.
Armed with this understanding, you can look at any line within /etc/fstab and see what it does. A possible exception is the line that mounts /proc, which is a bit special.
So, if you look at the following line:
UUID=9ACC9F03CC9ED8B9 /mnt/Windows ntfs-3g defaults,umask=007,gid=46,noauto,user 0 1
...you should be able to make out what each part does. Try before proceeding.
We can see that there is something identified not with a label but with a "UUID", and that this line is telling Ubuntu to mount it at "/mnt/Windows". The type is given as "ntfs-3g", and there are several options specified. A couple of the options are even not to hard to guess at: "noauto" means that it won't be automatically mounted right away, and "user" means that users can mount it if they want, without needing sudo.
Different ways of referring to a device or partition
You may notice that there are three ways in which
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=b793bd32-eb43-4f92-9a70-0a7b52456e77 /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.