I need to use an alternative fstab file for mounting a folder in another folder, like the command

mount --bind /folder1 /folder2

I tried the command

mount --fstab /pathToFile.fstab

as stated in the man:

-T, --fstab path

Specifies an alternative fstab file. If path is a directory then the files in the directory are sorted by strverscmp(3); files that start with . or without an .fstab extension are ignored. The option can be specified more than once. This option is mostly designed for initramfs or chroot scripts where additional configuration is specified beyond standard system configuration.

I create the file this way:

/folder1 /folder2 auto bind 0 0

but the command

mount --fstab /path

does nothing.

I added the line from the alternative file in /etc/fstab and with the

mount -a

the folder is mounted correctly.

Does anybody have experience with the --fstab option?

  • 2
    I guess you should try mount --fstab /path -a or mount --fstab /path /folder1. – Bodo Feb 13 at 9:53
  • Is your alternate fstab file called path and is it located in the root directory? This is what your mount --fstab /path command implies. – Kusalananda Feb 13 at 9:54
  • @Kusalananda /path was an example, my fstab file is in /ftp/mountFile.fstab, the file exist, but I didn't use the -a option, that solve my problem – Andy Feb 13 at 13:54

The command

mount --fstab /pathToFile.fstab

is the same as mount with no options when using the standard fstab file, i.e. "list mounted filesystems".

To actually mount all automountable filesystems specified in a custom fstab file similar to using mount -a with the standard fstab files, you'll need to use the --fstab option together with the -a option:

mount --fstab /pathToFile.fstab -a
  • Thank you very much, this answer solve my question! – Andy Feb 13 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.