• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

genfstab Command Examples in Linux

by Deepika

genfstab is a command-line tool that is part of the Arch Linux installation process. It’s used to generate an output that is suitable for addition to an fstab file. The fstab file is a system configuration file that contains information about the file systems that should be mounted at boot time.

When you install Arch Linux, you need to create an fstab file that lists the file systems that should be mounted on the system. This is typically done during the installation process by running the command genfstab -U /mnt >> /mnt/etc/fstab. This will generate the fstab file for the installed system, listing all the file systems that are currently mounted under the /mnt directory.

The -U flag is used to include the UUID of the partitions in the fstab file, this is useful as it allows you to mount partitions by UUID rather than by device name. This is useful as it allows you to mount partitions even if the device name changes. The genfstab script can also be used to generate an fstab file after the installation is complete, you can run the command genfstab -U / >> /etc/fstab to generate the fstab file for the currently running system.

It’s important to note that the fstab file should be reviewed before adding it to the system, as it may contain errors or inaccuracies. Also, it’s important to understand the options used in the fstab file, such as the file system type, the options and the dump frequency.

genfstab Command Examples

1. Display an fstab compatible output based on a volume label:

# genfstab -L path/to/mount_point

2. Display an fstab compatible output based on a volume UUID:

# genfstab -U path/to/mount_point

3. A usual way to generate an fstab file, requires root permissions:

# genfstab -U /mnt >> /mnt/etc/fstab

4. Append a volume into an fstab file to mount it automatically:

# genfstab -U path/to/mount_point | sudo tee -a /etc/fstab

Summary

In summary, genfstab is a command-line tool that is used to generate an output suitable for addition to an fstab file. It’s used during the Arch Linux installation process to create an fstab file that lists the file systems that should be mounted on the system at boot time. It’s also useful after the installation process to generate the fstab file for the currently running system.

Filed Under: Linux

Some more articles you might also be interested in …

  1. Comparing NET-TOOLS V/s IPROUTE Package Commands (ip Vs ifconfig command comparison)
  2. getsebool Command in Linux
  3. sshpass Command: Non-interactive Password Authentication with SSH
  4. How to manage File and Directory Permissions/Ownerships in Linux
  5. nmcli networking Command Examples
  6. macof: command not found
  7. gcov: command not found
  8. mktemp Command Examples in Linux
  9. xz Command Examples in Linux
  10. How to resize (extend) a partition-based file system in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright