What is Fstab in Linux?

What is Fstab in Linux?

The /etc/fstab file contains information about file systems.  It is used by several commands on Linux to define how file systems are mounted.  Every filesystem that Linux supports supports many different mount options depending on the file system.  For example, a filesystem called XFS, supports custom options like barriers/nobarriers, but ext4 supports options like discard if you are using solid state disks.

The /etc/fstab file is comprised for six fields or columns, device, mount point, file system type, mount options, dump options, fsck options.

Table 1
DeviceMount PointFile SystemMount OptionsDump OptionsFile System
Check Options
/dev/sda1/homeext3rw02
UUID=4dc0394e-605f-4e6e-8181-e65e3d2e4152/ext4rw,errors=remount-ro01
UUID=d0c7cad3-5f85-4b9d-80b7-acf9c8496b72noneswapsw00
proc/procprocnodev,noexec,nosuid00
/dev/VG00/lv01/usrxfsbarriers03
LABEL=BACKUP/localbtrfsdefaults04

Table 1 illustrates the fstab file in a table format. As you can see, you can as many entries in this file as you need. For complex layouts, you may have more or for simplier layouts, you may only have two or three entries, usually one for the / (root) filesystem, the proc file system and maybe swap, which is optional, but usually recommended.

Device

The device represents the hardware that you want to access.  The device, /dev/sda1 represents the first partion on the first disk of the system.  Refering to the device is one way to reference a device.  Another way, is to use the LABEL or UUID.  Both LABEL and UUID both have distinct advantantes in that the UUID or LABEL should be unique to the device and never change.  This means that if you re-order the drives, /dev/sda1 may become /dev/sdb1.  As you can see, this would be problematic as they system boots up and can not find the / (root) volume.  In newer distributions, you will  most likely see devices referenced by their UUID.

In addition there are other special devices, such as proc and cgroup.  The proc device is a special device that contains runtime information for your systems kernel.  If you run “cat /proc/cpuinfo” you will see information related to your current CPU.  The cgroup device is another special device used for Linux Containers (LXC) which is type of virtualization.

Mount Point

Mount point is the destination where you want the device to be accessible.  For example, the / (root) mount point, will always be at the top level, /.  However, you may have a seperate partition for /home, /var, or /usr, depending on your needs.

File System Type

As you work with Linux, you will notice that it supports many different types of operating systems.  Some he examples include ext2, ext3, ext4, xfs, jfs, btrfs and the list goes on.

Mount options

With such a large variety of file systems, they all have different options regarding how you mount them.  This column provides a location for providing mount options.  For example, if you are xfs, you may want to include barriers or nobarriers.  Another options is “defaults” which just says use the default options.

Dump Options

This column specifies whether the filesystem should be backed up using the dump command.  Most often this column is zero.

File System Check Options

The last column specifies the order that a filesystem check will be performed.  A value of zero indicates that the filesystem will never be checked.  The file systems, /proc, /cgroup, and /swap should never need to be checked, so a value of zero makes sense.

Read More Post

STAY CONNECTED

Most Popular

Why Serviced Apartments Are the Perfect Choice for Long-Term Stays in Singapore – Everything You Need to Know
17 Dec

Why Serviced Apartments Are the Perfect Choice for Long-Term Stays in Singapore – Everything You Need to Know

If you’re heading to Singapore for a few weeks or many months, maybe for work or study or just to

Manifesting Your Dream Career: Finding Your Passion And Purpose
01 Aug

Manifesting Your Dream Career: Finding Your Passion And Purpose

Are you passionate about finding your dream career? Manifesting can help you align your career with your passions and purpose.

Revolutionizing Your Ride: Expert Auto Service At Carolina Auto Service
27 Feb

Revolutionizing Your Ride: Expert Auto Service At Carolina Auto Service

Finding a reliable auto service provider is paramount in the bustling world of vehicle maintenance and repair. That's where Carolina

Floratam: The Robust Grass Solution From Council Growers SOD
25 Jan

Floratam: The Robust Grass Solution From Council Growers SOD

Floratam grass, a popular St. Augustine variety, has become a go-to choice for homeowners and landscapers seeking a lush, durable

Carolina Mobile Autoservice: Your Go-To For Expert Brake Service Repair
25 Jan

Carolina Mobile Autoservice: Your Go-To For Expert Brake Service Repair

For vehicle owners, the braking system is among the most critical components for safety and performance. Carolina Mobile Autoservice, a

Safeguarding Your Property: Expert Water Damage Services By MBC Capital
24 Jan

Safeguarding Your Property: Expert Water Damage Services By MBC Capital

Water damage can significantly impact homes and businesses, often leaving a trail of destruction and disruption in its wake. Understanding