Page 1 of 1

How to setup & manage your fstab for auto-mounting Rate Topic: -----

#1 no2pencil   User is online

  • Professor Snuggly Pants
  • member icon

Reputation: 6824
  • View blog
  • Posts: 31,462
  • Joined: 10-May 07

Post icon  Posted 15 January 2008 - 06:52 AM

How to setup fstab on your Linux/Unix system.

The file, /etc/fstab is short for file systems table. But can be easily remembered by "F Stab" or "FS Tab", either way :D

Security :
The file itself is the responsibility of the system administrator. It is best to keep this file writable only by the system admins, & not edit the file with a user level account.

Layout :
There are six columns to the fstab file.
The columns are as follows:

1. The device name or other means of locating the partition or data source.
2. The mount point, where the data is to be attached to the file-system.
3. The file-system type, or the algorithm used to interpret the file-system.
4. Options, including if the file-system should be mounted at boot. (kudzu is an option specific to Red Hat and Fedora Core.)
5. dump-freq adjusts the archiving schedule for the partition (used by dump).
6. pass-num indicates the order in which the fsck utility will scan the partitions for errors when the computer powers on.

Options common to all file-systems

The options field contains a comma-separated list of options which will be passed directly to mount when it tries to mount the file-system.

The options common to all file-systems are:

auto / noauto
This is similar to the -a option for the mount command. Mount will do try all known file systems when trying to found the device.
If you don't want the device to be mounted automatically, however, use the noauto option in /etc/fstab. With noauto, the device can be mounted only explicitly.
dev / nodev
Interpret/do not interpret block special devices on the filesystem.
exec / noexec
exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec would be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system. This might be the case of a Windows partition.
Mounts the file-system read-only.
Mounts the file-system read-write.
sync / async
sync means it's done synchronously.
suid / nosuid
Permit/Block the operation of suid, and sgid bits.
user / nouser
Permit any user to mount the file-system. This automatically implies noexec, nosuid, nodev unless overridden. If nouser is specified, only root can mount the file-system.
Use default settings. Equivalent to rw,suid,dev,exec,auto,nouser,async.

Example :
[[email protected] ~]# cat /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
# <file system> 		<mount point> 				<type> <options> 		<dump> <pass>
LABEL=/				 /					   	ext3	defaults		1 1
LABEL=/boot			 /boot				   	ext3	defaults		1 2
LABEL=/data			 /data				   	ext3	defaults		1 3
/dev/devpts			 /dev/pts					devpts  gid=5,mode=620  0 0
/dev/shm				/dev/shm					tmpfs   defaults		0 0
/dev/proc			   /proc				   	proc	defaults		0 0
/dev/sys				/sys						sysfs   defaults		0 0

# Network access (shared storage)
NetStore:/data/RPMs	 /usr/local/download/RPMs	nfs	 soft			0 0

# Removable media
/dev/fd0				/media/floppy		   	auto	pamconsole,exec,noauto,managed 0 0
/dev/hda				/media/cdrom				auto	pamconsole,exec,noauto,managed 0 0

If you are dual-booting your system with Windows, or have multiple OSs accross your network, you may wish to access some of your Windows drives via your Linux/Unix servers & workstations. For the Linux kernel provides full read/write support for FAT32 and the older FAT filesystems. Full NTFS read-only support is natively available in the kernel as well, but for write ability, you'll have to do some research. In most situations, mounting your Windows drives is simply a matter of reconfiguring your kernel with the right options. Once the partition can be mounted, you can add an entry similar to the following, to have it auto mounted everytime your Linux/Unix system starts.
/dev/hda1  /mnt/ntfs  ntfs  ro  0 0

For more information on how to setup NTFS, there is a good article available here.

For more information on fstab, please visit the following man pages:


Is This A Good Question/Topic? 0
  • +

Replies To: How to setup & manage your fstab for auto-mounting

#2 niceboy120   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-October 13

Posted 25 November 2013 - 03:16 PM

thanks, it's very useful.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1