Skip to main content

genfstab

Write fstab entries for what is mounted under <root>.

genfstab [-f <filter>] [-L|-U|-t <tag>] [-p|-P] <root>

genfstab prints the entries; append them to the new system's /etc/fstab yourself.

Options​

OptionDescription
-UUUID= for sources
-LLABEL= for sources
-t <tag><tag>= for sources: UUID, LABEL, PARTUUID, PARTLABEL
-f <filter>Only mountpoints starting with <filter>
-pLeave pseudo filesystems out (the default)
-PKeep pseudo filesystems
-h, --helpShow help
-V, --versionShow the version

Without -U, -L or -t, sources are device paths such as /dev/sda1, with the UUID and label in a comment above each entry. With a tag, it's the other way round: the tag is the source and the device goes in the comment.

tip

Use -U. Device names can change between boots; UUIDs don't.

Example​

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