• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / Linux sysadmin tutorials linux system administrator / fstab options with examples

fstab options with examples

The /etc/fstab (File System Table) file is used to define how storage devices, partitions, and file systems should be mounted automatically at boot.


Table of Contents

Toggle
  • 1. Viewing the /etc/fstab File
  • 2. /etc/fstab File Format
  • 3. Example /etc/fstab Entries
    • Mount an ext4 Partition
    • Mount a Swap Partition
    • Mount a Windows NTFS Partition
    • Mount a USB Drive (vFAT)
    • Mount an NFS Share
  • 4. Get Partition UUIDs for /etc/fstab
  • 5. Apply Changes Without Reboot
  • 6. Common Mount Options
  • 7. Troubleshooting /etc/fstab Issues
    • ✅ Summary

1. Viewing the /etc/fstab File

To display the contents of /etc/fstab:

cat /etc/fstab

or

sudo nano /etc/fstab

2. /etc/fstab File Format

Each line in /etc/fstab follows this format:

php-template
<DEVICE> <MOUNT_POINT> <FILESYSTEM> <OPTIONS> <DUMP> <FSCK_ORDER>
Column Description
DEVICE The disk/partition (e.g., /dev/sdb1 or UUID=xxxx).
MOUNT_POINT Directory where it is mounted (e.g., /mnt/data).
FILESYSTEM File system type (ext4, xfs, ntfs, vfat, etc.).
OPTIONS Mount options (defaults, noexec, ro, etc.).
DUMP Backup option (0 = no backup, 1 = backup with dump).
FSCK_ORDER File system check order (0 = no check, 1 = root, 2 = others).

3. Example /etc/fstab Entries

Mount an ext4 Partition

ini
UUID=1234abcd-5678 /mnt/data ext4 defaults 0 2

🔹 Mounts an ext4 file system at /mnt/data with default options.

Mount a Swap Partition

ini
UUID=5678efgh-9101 none swap sw 0 0

🔹 Enables a swap partition.

Mount a Windows NTFS Partition

ini
UUID=abcd1234-efgh-5678 /mnt/windows ntfs-3g defaults 0 0

🔹 Mounts an NTFS partition using ntfs-3g.

Mount a USB Drive (vFAT)

ini
UUID=9F7A-1D2C /mnt/usb vfat defaults,uid=1000,gid=1000 0 0

🔹 Ensures a FAT32 USB drive is mounted with correct permissions.

Mount an NFS Share

192.168.1.100:/shared /mnt/nfs nfs defaults 0 0

🔹 Mounts an NFS share from a remote server.


4. Get Partition UUIDs for /etc/fstab

Use blkid to find UUIDs:

sudo blkid

or

lsblk -o NAME,UUID,MOUNTPOINT

Use these UUIDs in /etc/fstab instead of /dev/sdX for reliability.


5. Apply Changes Without Reboot

To reload /etc/fstab without rebooting:

sudo mount -a

🔹 This mounts all file systems listed in /etc/fstab.


6. Common Mount Options

Option Description
defaults Uses default mount settings (rw, suid, dev, exec, auto, nouser, async).
ro Mount as read-only.
rw Mount as read-write.
noexec Prevents execution of binaries.
nosuid Ignores SUID bit for security.
nofail Continues boot even if the mount fails.
uid=1000,gid=1000 Sets owner to user ID 1000 (useful for USB drives).

7. Troubleshooting /etc/fstab Issues

If a misconfiguration causes boot failure:

  1. Boot into recovery mode or a live Linux USB.
  2. Edit /etc/fstab:
    sudo nano /etc/fstab
  3. Comment out the problematic line by adding # at the beginning.
  4. Save and reboot.

To check for errors before rebooting:

sudo mount -a

✅ Summary

  • /etc/fstab is used for automatic mounting.
  • Use blkid to get UUIDs for reliable mounting.
  • Mounting options affect performance and security.
  • Test changes with sudo mount -a before rebooting.

Primary Sidebar

Linux sysadmin tutorials linux system administrator

  • top 10 apt & apt-get commands (most used) apt vs apt-get
  • If-Else Statements in Shell Scripting
  • linux commands pdf (files & Directories, zip & unzip process, search etc)
  • Find Files with Specific Text on Linux grep find command
  • linux performance tuning inode limit file descriptors tco, kernel etc
  • Variables and Data Types in Shell Scripting
  • Top 10 most used Cat commands with examples (create, view, append files)
  • Ip tables / ufw / firewall d commands for block port ip rate limiting
  • Top 10 zip / tar commands to compress & extract files in linux
  • TOP 10 mv & cp commands in linux to move & copy files in Linux
  • Top 10 GREP Commands in linux to search files directory words strings
  • lsof netstat commands to know listening ports in linux 3 ways
  • Upgrade Ubuntu from 18.04 (19.10) to 20.04 LTS command line or gui server | desktop
  • 3 Ways (SCP, rsync, Sftp) linux server migration between two remote server apache nginx
  • linux system specs commands (CPU, Memory, Disk )speed, type. manufacture
  • linux sysctl command tweaks & hardening
  • linux security limits.conf deciding user limits process limits for nginx server
  • ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.
  • red hat linux certification cost jobs salary syllabus courses fees
  • ufw firewall commads allow port enable disable ubuntu 20.04
  • ddos attack prevention
  • change ssh port in linux - avoid sshd ddos attacks
  • ping command
  • memcached install ubuntu wordpress
  • check linux version (lsb_release -a) ubuntu debian 32 or 64 bit
  • rsync command linux with examples comparison to scp
  • how to uninstall package in linux ubuntu rpm, yum apt-get
  • increase open file limit linux File descriptor ft nginx , mysql, lemp
  • remove repository ubuntu
  • htop commad memory details virtual vs shard vs resident
  • chown command in Linux with Examples
  • Kill PHP process
  • VIrtual Memory vs RSS Memory vs Shared memory in Linux
  • oom killer fixing it by configuration linux ubuntu
  • Install Lemp nginx mysql php fpm Stack on Debian 11 with repository
  • connect two remote servers linux command line
  • auto start after oom killer Mysql & php fpm nginx etc ubuntu wth systemd or cron job
  • load average Linux 1, 5, 15 min 2,4,8 cores explained
  • Control Structures in Shell Scripting
  • Shell Scripting Roadmap for Beginners to Advanced
  • awk commands with practical examples
  • Shell Scripting Tutorial for Beginners 🚀
  • find Command in Linux with Examples
  • sed Command in Linux with Examples (Beginner to Advanced)
  • Linux Text processing commands in with Examples
  • linux disk management commands
  • fdisk command in linux with examples
  • how to add a new disk in linux
  • Linux mount Command with Examples
  • fstab options with examples
  • Top 50 Shell Scripting Interview Questions and Answers
  • Linux Networking Interview Questions and Answers
  • Linux Networking Commands Cheat Sheet with Examples pdf
  • Netstat & SS Commands cheat sheet with examples Interview Questions
  • Nmap Cheat Sheet – Network Scanning & Security
  • Bash Brackets ([], (), {}, $( ), $(( ))) – Types, Uses & Examples

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy