7.12. Creating the /etc/fstab File

The /etc/fstab file is used by some programs to determine where file systems are to be mounted by default, which must be checked, and in which order. Create a new file systems table like this:

The proc file-system does not have executables, suid, or devices. The sysfs and devpts file-systems do not have executables, or suid. The shm file-system do not have suid, or devices. You shouldn't have problems with the suggested options below, if you do please report them to mailto:hlfs-dev AT linuxfromscratch D0T org.

cat > /tmp/fstab.new << "EOF"
# Begin /etc/fstab

# file system  mount-point  type   options                   dump  fsck
#                                                                  order

/dev/[xxx]     /            [fff]  defaults                  1     1
/dev/[yyy]     swap         swap   pri=1                     0     0
/dev/[zzz]     /boot        [ggg]  noauto                    1     2
proc           /proc        proc   rw,noexec,nosuid,nodev    0     0
sysfs          /sys         sysfs  rw,noexec,nosuid          0     0
devpts         /dev/pts     devpts rw,nosuid,gid=4,mode=620  0     0
shm            /dev/shm     tmpfs  rw,nosuid,nodev           0     0
# End /etc/fstab
EOF
install -m644 /tmp/fstab.new /etc/fstab
rm /tmp/fstab.new

Replace [xxx], [yyy], [zzz], [fff], and [ggg] with the values appropriate for the system, for example, hdb3, hdb2, hdb1, ext3, and ext2, respectivelly. For details on the six fields in this file, see man 5 fstab.

When using a journalling file system, the 1 1 at the end of the line should be replaced with 0 0 because such a partition does not need to be dumped or checked.

The /dev/shm mount point for tmpfs is included to allow enabling POSIX-shared memory. The kernel must have the required support built into it for this to work (more about this is in the next section). Please note that very little software currently uses POSIX-shared memory. Therefore, consider the /dev/shm mount point optional. For more information, see Documentation/filesystems/tmpfs.txt in the kernel source tree.