From FreeBSDwiki
Jump to: navigation, search

/etc/fstab is the system config file used to control how filesystem devices are automatically mounted and/or fscked.

ph34r# cat /etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad4s1b             none            swap    sw              0       0
/dev/ad4s1a             /               ufs     rw              1       1
/dev/ad4s1e             /tmp            ufs     rw              2       2
/dev/ad4s1f             /usr            ufs     rw              2       2
/dev/ad4s1d             /var            ufs     rw              2       2
/dev/ad6s1e             /data           ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
/dev/da4s1              /mnt/usbdrive   msdos   rw,noauto       0       0

In the fstab file shown above, we can see entries for all the standard system partitions, as well as /cdrom and /mnt/usbdrive. The first column in each entry denotes the actual device location, the second shows the filesystem directory the device will be mounted to, the third shows the type of filesystem used on the device, the fourth shows options to be followed, and the last two devices discuss dumping and fscking of the device in question.

Since the /cdrom and /mnt/usbdrive devices are set to "noauto" in options, they will not be automatically mounted at boot time. Also note that they have "dump" and "pass" set to 0 and 0, so they will not be automatically backed up by the system "dump" command, nor will they be automatically fsck'ed at boot.

Also note that while the normal partitions are marked "rw", for ReadWrite, the CD-ROM is marked "ro" since it's a ReadOnly device, and the swap partition is marked "sw" since it's a swap partition, not a normal filesystem.

For the devices listed in /etc/fstab, mount and umount can be used with no argument other than the name of the mountpoint - for instance on the system whose fstab is displayed above, mount /mnt/usbdrive and mount -t msdos /dev/da4s1 /mnt/usbdrive would both do the exact same thing.

Enabling Soft-Updates

By enabling soft updates you can make your system faster and more reliable if there is a crash/power failure.

# tunefs -n enable /filesystem

Faster read performance

You can get faster read performance by not writing to the files access time every time you read. Warning: Some people don't think that this is the right way to do things, run at own risk.

In the options part of fstab for each disk add 'noatime'.

See also: Partitioning Tips and Tricks

Personal tools