DEV Community

Rohit Jain
Rohit Jain

Posted on

Linux FSTAB

Linux FSTAB

The /etc/fstab file in Linux is a configuration file that contains information about file systems. It is used to mount file systems automatically during system boot up. Each line in the file represents a separate file system and is organized into columns that provide information about the file system.

Understanding the columns in /etc/fstab

The columns in the /etc/fstab file are as follows:

  1. File system: The location of the file system (e.g. /dev/sda1)
  2. Mount Point: The directory where the file system will be mounted (e.g. /mnt/data)
  3. File System Type: The type of file system (e.g. ext4, ntfs, etc.)
  4. Options: Mount options for the file system (e.g. rw, ro, defaults, etc.)
  5. Dump: Specifies whether to include the file system in the backup process (0 or 1)
  6. Pass: Specifies the order in which fsck checks the file system during boot up (0 or 1)

Adding a file system to /etc/fstab

To add a file system to the /etc/fstab file, you need to know the file system location, mount point, file system type, and mount options.

For example, if you want to add an NTFS partition located at /dev/sda1 and mount it at /mnt/data with read-write permissions, you would add the following line to /etc/fstab:/dev/sda1 /mnt/data ntfs rw 0 0

Note that you need to have root privileges to edit the /etc/fstab file.

Mounting and unmounting file systems

You can mount and unmount file systems using the mount and umount commands. For example, to mount the /mnt/data file system, you would run the following command:

sudo mount /mnt/data

And to unmount the /mnt/data file system, you would run:

sudo umount /mnt/data

It's important to unmount a file system before disconnecting or removing the device to avoid data corruption.

Billboard image

Monitor more than uptime.

With Checkly, you can use Playwright tests and Javascript to monitor end-to-end scenarios in your NextJS, Astro, Remix, or other application.

Get started now!

Top comments (0)

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay