0

How do I use /etc/export.d/ to export filesystems?

I am attempting to export an sge cell's configuration via nfs. However, the export does not appear to work.

# cat /etc/exports.d/sge-example.com
/opt/sge/example.com 192.0.2.0/24(ro)
# exportfs -rv
exportfs: No file systems exported!
# strace exportfs -rv 2>&1
execve("/usr/sbin/exportfs", ["exportfs", "-rv"], [/* 27 vars */]) = 0
brk(NULL)                               = 0x55d9bfde2000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb67e9e0000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=28419, ...}) = 0
mmap(NULL, 28419, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb67e9d9000
close(3)                                = 0
open("/lib64/libwrap.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3403\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=42520, ...}) = 0
mmap(NULL, 2138208, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb67e5b5000
mprotect(0x7fb67e5be000, 2093056, PROT_NONE) = 0
mmap(0x7fb67e7bd000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8000) = 0x7fb67e7bd000
mmap(0x7fb67e7bf000, 96, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb67e7bf000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\35\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2127336, ...}) = 0
mmap(NULL, 3940800, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb67e1f2000
mprotect(0x7fb67e3aa000, 2097152, PROT_NONE) = 0
mmap(0x7fb67e5aa000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b8000) = 0x7fb67e5aa000
mmap(0x7fb67e5b0000, 16832, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb67e5b0000
close(3)                                = 0
open("/lib64/libnsl.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240@\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=113584, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb67e9d8000
mmap(NULL, 2198200, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb67dfd9000
mprotect(0x7fb67dfef000, 2093056, PROT_NONE) = 0
mmap(0x7fb67e1ee000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7fb67e1ee000
mmap(0x7fb67e1f0000, 6840, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb67e1f0000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb67e9d6000
arch_prctl(ARCH_SET_FS, 0x7fb67e9d6740) = 0
mprotect(0x7fb67e5aa000, 16384, PROT_READ) = 0
mprotect(0x7fb67e1ee000, 4096, PROT_READ) = 0
mprotect(0x7fb67e7bd000, 4096, PROT_READ) = 0
stat("/etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned", 0x7ffffa926630) = -1 ENOENT (No such file or directory)
mprotect(0x55d9be0a5000, 4096, PROT_READ) = 0
mprotect(0x7fb67e9e1000, 4096, PROT_READ) = 0
munmap(0x7fb67e9d9000, 28419)           = 0
getpid()                                = 12763
rt_sigaction(SIGUSR1, {0x55d9bde9d580, [USR1], SA_RESTORER|SA_RESTART, 0x7fb67e227270}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGUSR2, {0x55d9bde9d580, [USR2], SA_RESTORER|SA_RESTART, 0x7fb67e227270}, {SIG_DFL, [], 0}, 8) = 0
stat("/etc/nfs.conf", {st_mode=S_IFREG|0644, st_size=953, ...}) = 0
open("/etc/nfs.conf", O_RDONLY)         = 3
brk(NULL)                               = 0x55d9bfde2000
brk(0x55d9bfe03000)                     = 0x55d9bfe03000
brk(NULL)                               = 0x55d9bfe03000
read(3, "#\n# This is a general conifgurat"..., 953) = 953
close(3)                                = 0
access("/proc/fs/nfs/filehandle", F_OK) = -1 ENOENT (No such file or directory)
access("/proc/fs/nfsd/filehandle", F_OK) = 0
open("/var/lib/nfs/export-lock", O_RDWR|O_CREAT, 0666) = 3
fcntl(3, F_SETLKW, {l_type=F_WRLCK, l_whence=SEEK_CUR, l_start=0, l_len=0}) = 0
open("/etc/exports", O_RDONLY)          = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb67e9df000
read(4, "", 4096)                       = 0
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0x7fb67e9df000, 4096)            = 0
openat(AT_FDCWD, "/etc/exports.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
getdents(4, /* 3 entries */, 32768)     = 72
getdents(4, /* 0 entries */, 32768)     = 0
close(4)                                = 0
write(2, "exportfs: ", 10exportfs: )              = 10
write(2, "No file systems exported!", 25No file systems exported!) = 25
write(2, "\n", 1
)                       = 1
open("/var/lib/nfs/.etab.lock", O_RDWR|O_CREAT, 0600) = 4
fcntl(4, F_SETLKW, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
open("/var/lib/nfs/etab.tmp", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
close(5)                                = 0
open("/var/lib/nfs/etab.tmp", O_RDONLY) = 5
open("/var/lib/nfs/etab", O_RDONLY)     = 6
read(5, "", 4096)                       = 0
read(6, "", 4096)                       = 0
close(5)                                = 0
close(6)                                = 0
unlink("/var/lib/nfs/etab.tmp")         = 0
close(4)                                = 0
stat("/var/lib/nfs/etab", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("/proc/net/rpc/auth.unix.ip/flush", O_RDWR) = 4
write(4, "1525480721\n", 11)            = 11
close(4)                                = 0
open("/proc/net/rpc/auth.unix.gid/flush", O_RDWR) = 4
write(4, "1525480721\n", 11)            = 11
close(4)                                = 0
open("/proc/net/rpc/nfsd.fh/flush", O_RDWR) = 4
write(4, "1525480721\n", 11)            = 11
close(4)                                = 0
open("/proc/net/rpc/nfsd.export/flush", O_RDWR) = 4
write(4, "1525480721\n", 11)            = 11
close(4)                                = 0
fcntl(3, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_CUR, l_start=0, l_len=0}) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

The same issue does not occur if I include the same line directly in /etc/exports.

  • I was attempting to as briefly as possible show that it did not stat nor open any other files containing the relevant path, but I've now included the full strace. – 84104 May 5 '18 at 0:44
2

Of course the answer turns out to be in the man page.

       After  reading  /etc/exports exportfs reads files in the /etc/exports.d
       directory as extra export tables.  Only files ending  in  .exports  are
       considered.   Files  beginning  with a dot are ignored.  The format for
       extra export tables is the same as /etc/exports

So you have to name the file something like /etc/exports.d/sge.example.com.exports.

  • Ah, there it is all the way at the bottom of exports(5). A similar message is at the bottom of exportfs(8). I figured it might be something like this. Autofs behaves in a similar way. – 84104 May 5 '18 at 4:01

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.