Configuration files: The /etc/fstab

This file is read at boot time for mounting:
local filesystems: hard disk partitions and cd/dvd readers/recorders
network filesystems: shares in nfs or smb (microsoft file-printer sharing)
The swap filesystem(s): up to 16
The Pseudo-filesystems: devpts, proc usbfs etc.

mount means placing a filesystem in the directory tree for
common disk operation use (making the resource available to the OS).

Everything can be altered in run time without restarting BUT:
Do Not Touch the pseudo-filesystems.

<spaces> and <tabs> are treated the same way. Do not worry.

Here is an example of an fstab:


/dev/hda2 / ext3 defaults 1 1
/dev/hda3 /mnt/mandrake ext3 ro 1 1
/dev/hda5 /home ext3 defaults 1 2
/dev/hda6 swap swap defaults 0 0
/dev/cdrecorder /mnt/cdrecorder auto noauto,user,ro, 0 0
/dev/cdrom /mnt/cdrom auto noauto,user,exec,ro 0 0






/dev/hda1 /mnt/c vfat noauto,user 0 0
/dev/hdb1 /mnt/d vfat uid=1001 0 0
/dev/fd0 /mnt/floppy auto noauto,user 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0

/home/shared/documents/image.iso /mnt/image/ iso9660 auto,ro,loop

//foo/documents /mnt/smb/foo/documents smbfs noauto,user,passwd=

foo:/home      /mnt/nfs/foo/home    nfs     noauto,user


/dev/sda1      /mnt/flash           auto    noauto,user

Study the logic of the fstab:

device file mount point filesystem type options filesystem check options

In options: noauto means that the mount will not be automated.
            user means allowing users to mount - unmount filesystems.
            users means that one user can mount a filesystem and another can unmount it!

/dev/hdb1 will be mounted at boot time, but only micro (uid=1001) and root can "see" it


The first lines are usually created by the Distro automated procedure.
I corrected the soft link /dev/cdrecorder to point to /dev/sr0 (an emulated scsi device for the cd recorder).

For details about Soft (Symbolic) links see FileMe and TrickMe Pages.

/dev/cdrom      is a soft link to /dev/hdc (the secondary master ide hd or cdrom)
/dev/cdrecorder is a soft link to /dev/sr0 (emulated scsi device of /dev/hdd)

As you can see, I have mounted an iso image in my filesystem.

Host foo shares via smb (Microsoft protocol of file and printer sharing).
This share is in security level=share And guest ok so no password is required.
If you want a more secure level, then the servers (not the client) level can be one of these: user, server,domain.

Host foo also exports via nfs (Network Filesystem) a /home dir, that can be common for all hosts in the network, if you mount it in /home (in each client). As you see, the nfs does not use authentication, but gives permissions according to user id. In general, I use nfs only in a secure network (protected by firewall).

And, finally, a 256 Mb fat32 formatted usb flash disk, can be hotplugged to the system. If the kernel is configured for hotplug, (and in most distros it is) it will attach the flash as a scsi device and assign it to the first free scsi device file in /dev. In my case /dev/sda.