Forrest logo
back to the genfstab tool

genfstab:tldr:829ad

genfstab: Append a volume into an fstab file to mount it automatically.
$ genfstab -U ${path-to-mount_point} | sudo tee -a /etc/fstab
try on your machine

The genfstab command is used to generate an entry list of file systems for the /etc/fstab file in Linux. The /etc/fstab file contains information about the file systems to be mounted at system boot.

The -U option is used to generate UUID-based filesystem labels for the entries in the /etc/fstab file. UUIDs (Universally Unique Identifiers) are unique identifiers assigned to filesystems, making sure that filesystems are referenced consistently even if their device names change.

${path-to-mount_point} is the placeholder for the actual path to the mount point on the file system that you want to generate an entry for. It should be replaced with the specific path, such as /, /home, or any other directory where you have mounted a file system.

The | (pipe) symbol is used to redirect the output of the genfstab command to the tee command.

sudo tee -a /etc/fstab is used to append (-a) the output of the genfstab command to the /etc/fstab file. The sudo command is used to run the subsequent command with administrative privileges, as editing the /etc/fstab file usually requires root or superuser access.

In summary, this command generates an entry for the specified mount point using UUID-based filesystem labels and appends that entry to the /etc/fstab file with administrative privileges.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the genfstab tool