Take the 2-minute tour ×

I use autofs to mount some iso files in folder /mnt/iso:


The autofs is working fine and I can see the contents of iso files:

# ls /mnt/iso/fedora.13/
# ls /mnt/iso/fedora.14/
# ls /mnt/iso/fedora.15/

After finish the autofs testing. I force unmount all iso folders:

# umount -l /mnt/iso/*

I then export the /mnt/iso in /etc/exports:


The NFS service is working fine too. I may mount the /mnt/iso from another machine via nfs client:

# mount -t nfs4 <nfs-server>:/mnt/iso /mnt

I can see all iso mount in /mnt/ folder:

# ls /mnt
dr-xr-xr-x 15 nobody nobody 4096 2011-06-11 10:23 .
drwxr-xr-x 24 root   root   4096 2011-02-08 08:45 ..
drwxr-sr-x  7 nobody nobody 4096 2010-05-13 09:06 fedora.13
drwxr-sr-x  7 nobody nobody 4096 2010-10-22 02:32 fedora.14
drwxrwsr-x  7 nobody nobody 4096 2011-05-14 03:50 fedora.15

However, when I try to list the contents for each folder:

#  ls /mnt/fedora.13

Nothing shown on screen. Using command like this

#  ls /mnt/fedora.13/*


ls: cannot access /mnt/fedora.13/*: No such file or directory

The only case I success to list out the content of the iso folders in nfs client machine is using this steps:

Unmount nfs share from client machine:

# umount /mnt

using ls to show all sub-trees of /mnt/iso in nfs server:

# ls /mnt/iso/*

The autofs will mount all iso files automatically.

Mount the nfs folder in client machine:


List the sub-trees of /mnt:

# ls /mnt/*

You may then see all the contents in nfs client machine.

However, this defeat the purpose of autofs, as I need to show the contents once in the autofs machine first.

Does anyone has any ideas? I am using the following:

  1. Fedora 13 x86_64
  2. autofs-5.0.5-28
  3. nfs-utils-
share|improve this question

1 Answer 1

up vote 3 down vote accepted

I think you have a cart before the horse problem here in that when you export a file system using NFS it locks on to the source direcotory. You are trying to not even have that source directory available at that time and only put something there via a mount later.

This will not work, because once you give NFS a handle on something to share, it will always share that thing, even if it ends up underneath a layer of mounts.

Let's say you setup a directory with a file 'frog' and export it with nfs:

[server] $ mkdir /mnt/test && touch /mnt/test/frog
[server] $ echo '/mnt/test *(ro)' >> /etc/exports
[server] $ exportfs -a

Then you mount it on a client somewhere, you will see the file frog as expected:

[client] $ mkdir /mnt/test
[client] $ mount -t nfs server:/mnt/test /mnt/test
[client] $ ls $/mnt/test

Now let's say you mount something else on top of that folder on the server:

[server] $ mkdir /mnt/test2 && touch /mnt/test2/fish
[server] $ mount -o bind /mnt/test2 /mnt/test
[server] $ ls /mnt/test

Spiffy. But what is nfs serving up?

[client] $ ls /mnt/test

You can't even get to that file frog on the server because it's got a different thing mounted on top of it, but NFS is serving up that under layer!

To make a long story short, if you want to export your file systems via NFS you will need to have them mounted up properly at the time NFS starts up and exports them and they will need to stick around. Exporting file systems that are themselves mounted using autofs will never work quite right. You will need to permanently mount those ISOs in order to export them via NFS.

share|improve this answer

Your Answer


