25

I'm trying to setup an automatically mounted volume, and noticed that there is now an /etc/fstab.d/ on my server. I created a new file in the directory with the following contents:

# backupstore: large volume
/dev/mapper/bagend-backupstore  /mnt/backupstore        ext4    auto,relatime,users,sync        0       0

But when I run mount -a the volume is not mounted. Also, when I run mount /mnt/backupstore or /dev/mapper/bagend-backupstore I get told that the system couldn't find the entry in fstab (and to pre-empt: yes, the device and mount-point are correct - I can easily mount this with mount -t ext4 /dev/mapper/bagend-backupstore /mnt/backupstore)

When I delete the file from /etc/fstab.d/ and put the entry into the main /etc/fstab file, I have no problems mounting the volume.

So, can the mount command be made to check for entries in /etc/fstab.d/ and if yes, what do I do to make it happen?

2 Answers 2

21
  • /bin/mount cannot read /etc/fstab.d yet, only the library (libmount) can.
  • This is a known "wishlist" bug in util-linux, the package which provides mount
  • The feature has been added in the latest util-linux 2.21 (the release notes say "Use filter arg of scandir* to pickup /etc/fstab.d/*.fstab files")
  • Since even Debian Unstable (Sid) is on version 2.20-x of util-linux, I doubt we'll see 2.21 in Ubuntu until 13.04
  • If you need it sooner, you can either compile 2.21 from the kernel.org source, but I'd recommend you wait until it at least makes its way into Debian (util-linux provides a number of other critical system utilities/libraries as well)
5
  • As an update, Ubuntu 13.04 is still using version 2.20.1 of util-linux.
    – Blair
    May 6, 2013 at 23:19
  • 3
    As an update Ubuntu 14.04 is still using version 2.20.1 of util-linux May 23, 2014 at 14:13
  • 2
    Ubuntu 14.10 has util-linux 2.25. However I don't think Ubuntu's mountall supports /etc/fstab.d, so don't expect these to be mounted automatically on boot. Nov 14, 2014 at 10:48
  • 2
    What's the status on Ubuntu 16.04?
    – a06e
    Sep 22, 2016 at 16:47
  • As @karel-zak mentions in their answer, The support for /etc/fstab.d was added to mount and then reverted. Support won't be added to mount.
    – gene_wood
    Dec 22, 2022 at 21:10
13

The /etc/fstab.d support has been reverted from mount(8) after upstream discussion. The mount tab directories are supported by libmount only. It's not planned to support fstab.d in mount(8) by default.

The problem is that /etc/fstab is de facto standard used on many places (libc, systemd, UI programs, ..) and it's unreal wish that all the places can be changed to support fstab.d.

Anyway, you can use a new mount(8) from util-linux >= 2.21 and a new option --fstab <path> to specify alternative mount table, this option also supports directories. It means you have to explicitly specify the directory -- mount(8) will not read it by default. See mount(8) man page for more details.

1
  • libmount might have superseded getfsent and made the exact files an implementation detail. Or getfsent might have been updated. Oh well, there's always Augeas.
    – Tobu
    Jun 19, 2013 at 15:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .