2

I have 2 data sources. One is btrfs (raid) and one is a simple ext4 partition. Those should be transparently displayed as one. This is a simple read only example, but the lower/upper/workdir version produces the same problem, with btrfs as upper and ext4 as lower.

manual mount:

mount -t overlay overlay -o lowerdir=/mnt/raid/folder1/:/mnt/ext4/folder1 -o comment=merge  -o nfs_export=on /data/merged

fstab mount:

overlay /data/merged overlay defaults,lowerdir=/mnt/raid/folder1/:/mnt/ext4/folder1,comment=merge,nfs_export=on 0 0

this is my nfs export:

/data/merged 192.168.0.0/255.255.255.0(ro,fsid=1,async,insecure,crossmnt)

exportfs -ra produces: exportfs: /data/merged does not support NFS export

My configuration: Ubuntu 18.04 LTS with HWE kernel 4.18.0-13-generic This is my main source for the config: https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt

Maybe I am missing some NFSv4 stuff (which is needed for nfs exporting an overlayfs) ?

edit: as requested, my mounts for the sourcecs:

UUID=d138b8fa-83e1-4df7-80dc-c1ed7d866f77       /mnt/raid       btrfs   defaults        0       2
UUID=6bb8f391-0872-40cf-8aff-8bdb32632098       /mnt/ext4        ext4    errors=remount-ro 0 2

edit2:

grep -H . /sys/module/overlay/parameters/*
/sys/module/overlay/parameters/nfs_export:N
wuppi
  • 123
  • 1
  • 6
  • What kernel do you run? The message indicates that NFS exports are not supported with your kernel yet. – Thomas Jan 20 '19 at 08:45
  • @Thomas uname -a = "4.18.0-13-generic #14~18.04.1-Ubuntu SMP Thu Dec 6 14:09:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux" how can I find out if the kernel supports it? The feature is "availble" since 4.16 – wuppi Jan 20 '19 at 11:37
  • That kernel version should support it. You may want to add the kernel version and the output of `grep -H . /sys/module/overlay/parameters/*` to your question. – Thomas Jan 20 '19 at 12:18
  • 1
    result `/sys/module/overlay/parameters/nfs_export:N` --- so no support? – wuppi Jan 20 '19 at 12:22
  • There does not appear to be an overlay option called "comment=". Please advise. – BrianTheLion Oct 31 '19 at 03:09
  • 1
    @BrianTheLion the comment option is an fstab feature: http://man7.org/linux/man-pages/man5/fstab.5.html – wuppi Nov 06 '19 at 08:18

1 Answers1

7

From kernel.org and from dmesg while trying to reproduce the error you also have to specify

  • -o index=on
  • -o index=on -o redirect_dir=nofollow when there is no upperdir

Your mount command then should be as follows.

mount -t overlay overlay -o lowerdir=/mnt/raid/folder1/:/mnt/ext4/folder1 -o comment=merge -o nfs_export=on -o index=on -o redirect_dir=nofollow /data/merged

The output of

/sys/module/overlay/parameters/nfs_export:N

shows the default of the mountoption and verifies that it is actually available.

Thomas
  • 4,155
  • 5
  • 21
  • 28