Monday, February 02, 2009


Key points:

One can use Label, UUID, besides the device nodes to mount a device.

More information can be found at

Understanding fstab

Sorry this is such a long post.

I added much of this information to the Ubuntu wiki.

Ubuntu Wiki : fstab

There are essentially 5 sections:

1. Introduction / Mount.
2. "fstab syntax" - Syntax and fstab options.
3. How to label, FAT and Linux file systems.
4. Examples, FAT and Linux native file systems.
5. References

Scroll down to the section you need.


/etc/fstab is a system configuration file and is used to tell the Linux kernel which partitions (file systems) to mount and where on the file system tree.

/etc/mtab is an index of all mounted partitions/file systems.

Note: See references section at the end of this how to for useful links.

How to mount

The mount command and fstab go hand in hand:

1. Options for mount and fstab are similar.
2. If a device/partition is not listed in fstab ONLY ROOT may mount the device/partition.
3. Users can mount a removable device using pmount.
4. Users may mount a device/partition if the device is in fstab with the proper options.

How to mount
Mount Partitions Automatically (At BOOT).
Filesystems and Mounting Thanks Hermanzone

mount has a multitude of options. Manpage: man mount

pmount: Pmount allows a user to mount removable media.
pmount uses /media/ as the mount point.


pmount /dev/dsa1 data

This creates a directory "data" in /media (mount point is /media/data) and mounts your removable device there.

To unmount:


Note: pmount does not like to mount to an existing directory in /media.

* For example, if you have a directory /media/usb ; pmount /dev/sda1 usb may fail.
* If you are having problems with gnome-volume-manager or pmount check the contents of /media and delete directories as needed.
* Obviously do not delete a directory in /media if a device is mounted to this mount point.

Configure pmount for internal drives

To show your partitions/usb devices, first plug in your usb card.

To list your mounted partitions:


To list all your partitions, mounted or not:

sudo fdisk -l

To list all your partitions by UUID:
First connect all your devices, then:

ls /dev/disk/by-uuid -alh

============== END OF INTRODUCTION ===============

fstab Syntax

[Device] [Mount Point] [File_system] [Options] [dump] [fsck order]
Device = Physical location.

/dev/hdxy or /dev/sdxy.

x will be a letter starting with a, then b,c,....
y will be a number starting with 1, then 2,3,....

Thus hda1 = First partition on the master HD.

See Basic partitioning for more information

Note: zip discs are always numbered "4".
Example: USB Zip = /dev/sda4.

Note: You can also identify a device by udev, volume label (AKA LABEL), or uuid.

These fstab techniques are helpful for removable media because the device (/dev/sdxy) may change. For example, sometimes the USB device will be assigned /dev/sda1, other times /dev/sdb1. This depends on what order you connect USB devices, and where (which USB slot) you use to connect. This can be a major aggravation as you must identify the device before you can mount it. fstab does not work well if the device name keeps changing.

To list your devices, first put connect your USB device (it does not need to be mounted).
By volume label:

ls /dev/disk/by-label -lah

By id:

ls /dev/disk/by-id -lah

By uuid:

ls /dev/disk/by-uuid -lah

IMO, LABEL is easiest to use as you can set a label and it is human readable.

The format to use instead of the device name in the fstab file is:


No comments:

Blog Archive