Imagine a situation that you have mounted something (e.g. some nfs share) anywhere on your system using the mount command. Everything works fine but if you restart your computer, your folder is not mounted anymore.
If you would like your system to mount everything on boot, updating /etc/fstab file is the way to go. The file fstab is a plain text configuration file for setting mount points. Fstab is an abbreviation of File System Table. For altering this file you'll need to become root. It should be located in /etc/fstab on all distributions.
If you open your fstab file it should look like this one:
# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#
proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults 0 1
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/sda5 /win ntfs 0 0You can see, that the syntax is very simple. Every one line in this file stands for one mounted device. There should always be 6 parameters on every line, divided by one or more spaces.
The first parameter is the device you would like to mount and the second one specifies the mount point (a folder, where the device will be mounted). The third parameter stands for the file system. You may also specify auto, if you wish to let the system guess.
The fourth parameter is for writing parameters. The most important are:
- noauto - don't connect automatically on startup
- users - users can access this device
- codepage - codepage of filenames
- iocharset - codepage to which the filenames will be converted
- noexec - don't execute files on this device
- umask - setting file access rights mask
- ro - read only
- rw - read and write.
All values are separated by comma(,). If you don't have any parameters to set write defaults.
The fifth parameter may only be 1 or 0. If you'd like this drive to be backuped by the dump, then set 1, otherwise set 0.
And finally, the sixth parameter marks the order for drive check by the fsck. The root folder / should always be checked first, so set 1. If you don't want your drive to be checked, then write 0. This will disable the check.
You can of course use fstab to mount nfs or samba shares. This is an example of setting nfs share:
10.0.0.1:/sharing /mnt/server nfs rw 0 0
If you have this line in your fstab file, then /sharing folder on 10.0.0.1 will be always mounted to /mnt/server on your local system. If you are using samba, then it is very similar, but you will usually have to set your username and a password.
//10.0.0.1/sharing /mnt/server smbfs username=user,password=pass,rw 0 0
If you are looking for more detailed description, then you may have a look at fstab man page.