大网数据广告活动
服务器运维问答

NFS export an overlay of ext4 and btrfs

· 52CE 我爱测

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, wit…

问题原文

原帖链接 · wuppi · CC BY-SA 4.0

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

已采纳解答

原帖链接 · Thomas · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-01-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。