Welcome to Dream.In.Code
Become an Expert!

Join 149,921 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,990 people online right now. Registration is fast and FREE... Join Now!




How to setup & manage your fstab for auto-mounting

 
Reply to this topicStart new topic

> How to setup & manage your fstab for auto-mounting

no2pencil
Group Icon



post 15 Jan, 2008 - 05:52 AM
Post #1


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 biggrin.gif

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.
ro
Mounts the file-system read-only.
rw
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.
defaults
Use default settings. Equivalent to rw,suid,dev,exec,auto,nouser,async.

Example :
CODE

[root@LocalServer ~]# 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.
CODE

/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:

FreeBSD
NetBSD
OpenBSD
Linux
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 1/8/09 02:48PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month