Fstab: Difference between revisions
Merge-delete (talk | contribs) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 26: | Line 26: | ||
<td align="center">/mnt/windows</td> | <td align="center">/mnt/windows</td> | ||
<td align="center">vfat</td> | <td align="center">vfat</td> | ||
<td align="center"> | <td align="center">defaults</td> | ||
<td align="center">0</td> | <td align="center">0</td> | ||
<td align="center">1</td> | <td align="center">1</td> | ||
Line 62: | Line 62: | ||
==Useful Examples== | ==Useful Examples== | ||
CDROM:<br> | CDROM/DVD:<br> | ||
:/dev/ | :/dev/sr0 /media/dvd auto noauto,ro,owner,users 0 0 | ||
[[USB Memory Stick]]:<br> | [[USB Memory Stick]]:<br> | ||
:/dev/sda1 /mnt/memstick auto noauto,owner,users 0 0<br> | :/dev/sda1 /mnt/memstick auto noauto,owner,users 0 0<br> | ||
(make sure to <code>mkdir /mnt/memstick</code> after changing your /etc/fstab). | (make sure to <code>mkdir /mnt/memstick</code> after changing your /etc/fstab). | ||
[[External USB Drive / NTFS partition]] | [[External USB Drive / NTFS partition]] | ||
:/dev/sdd1 /media/1T ntfs-3g | :/dev/sdd1 /media/1T ntfs-3g auto 0 0 | ||
(/dev/sdd1 is your external USB hard drive and /media/1T is destination folder) | (/dev/sdd1 is your external USB hard drive and /media/1T is destination folder) | ||
Latest revision as of 10:38, 30 January 2013
The /etc/fstab file tells the system how and where to mount filesystems by default.
Syntax
The syntax of the file is this:
MAN PAGE-ese: | FS_SPEC | FS_FILE | FS_VFSTYPE | FS_MNTOPS | FS_FREQ | FS_PASSNO |
IN ENGLISH: | DEVICE | MOUNT_POINT | FILESYSTEM | OPTIONS | DUMP | FSCK_ORDER |
EXAMPLE: | /dev/hdb1 | /mnt/windows | vfat | defaults | 0 | 1 |
Field Descriptions
FS_SPEC (DEVICE) - the device or remote filesystem to be mounted.
FS_FILE (MOUNT_POINT) - the mount point for the filesystem. NOTE: For swap partitions, this field should be specified as `none'. If the name of the mount point contains spaces these can be escaped as `\040'.
FS_VFSTYPE (FILESYSTEM)- the type of the filesystem. As of Slackware 10.2, the FILE_SYSTEM choices are:
- auto, adfs, affs, autofs, coda, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, nfs4, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xfs, xiafs and possibly others.
NOTE: for swap-able and portable devices (e.g. memory sticks and CDROMs), auto
is the best choice because it allows the computer to determine the correct filesystem.
FS_MNTOPS (OPTION) - the (comma seperated) mount options. See the MOUNT command's MAN PAGE for the options because there are MANY!
The most commonly used options are:
- noauto - do not mount this device/partition automatically on boot-up.
- ro - mount this device/partition READ-ONLY (e.g. CDROM).
- owner - Only allow the owner to mount and un-mount this device/partition.
- users - Allow any user to mount or unmount this device/partition.
FS_FREQ (DUMP) - used for these filesystems by the dump command to determine which filesystems need to be dumped. If the fifth field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped. For the most part, this should be "0" (zero).
FS_PASSNO (FSCK_ORDER) - used by the fsck program to determine the order in which filesystem checks are done at reboot time. The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked.
Benefits Of fstab Entries
Once you have a device in the fstab, mounting become VERY easy. Instead of having to:
mount -t iso9660 /dev/hdb1 /mnt/cdrom
every time you want to use the CDROM, you can just type:
mount /mnt/cdrom
IF you have the entry in your fstab.
Useful Examples
CDROM/DVD:
- /dev/sr0 /media/dvd auto noauto,ro,owner,users 0 0
- /dev/sda1 /mnt/memstick auto noauto,owner,users 0 0
(make sure to mkdir /mnt/memstick
after changing your /etc/fstab).
External USB Drive / NTFS partition
- /dev/sdd1 /media/1T ntfs-3g auto 0 0
(/dev/sdd1 is your external USB hard drive and /media/1T is destination folder)
Note: For changing who can access the filesystem on NON-Native linux formats see Permissions and Umasks and Windows Partitions