# Gentoo NFS server, ubuntu client: Can mount but no files

## dylanthomasfan

Hello,

I am running gentoo-2.6.37-r4 on an AMD64 machine A=10.10.1.3. I am sharing this with another machine, a Ubuntu maverick, with IP 10.10.1.4 (B). So, I export my filesystem like so on machine A.

```
MACHINE-A # more /etc/exports

/storage/    10.10.1.4(async,ro,no_subtree_check,all_squash,anonuid=1000,anongid=1000)

MACHINE-A # ls -l /storage

total 12

drwxrwxrwx 41 someuser someuser 4096 Apr 13 21:30 mp3

drwxrwxrwx 33 someuser someuser 4096 Apr 18 21:54 music

drwxrwxrwx  4 someuser someuser 4096 Apr 12 21:12 photos

```

I then 

```
exportfs -av
```

 and then 

```
/etc/init.d/nfs restart
```

 and confirm that nfs is running and will accept both NFS version 2 and 3:

```

MACHINE-A # rpcinfo -p

   program vers proto   port  service

    100000    4   tcp    111  portmapper

    100000    3   tcp    111  portmapper

    100000    2   tcp    111  portmapper

    100000    4   udp    111  portmapper

    100000    3   udp    111  portmapper

    100000    2   udp    111  portmapper

    100024    1   udp  46481  status

    100024    1   tcp  54519  status

    100005    1   udp  47437  mountd

    100005    1   tcp  48181  mountd

    100005    2   udp  47768  mountd

    100005    2   tcp  53891  mountd

    100005    3   udp  42775  mountd

    100005    3   tcp  44776  mountd

    100003    2   tcp   2049  nfs

    100003    3   tcp   2049  nfs

    100003    2   udp   2049  nfs

    100003    3   udp   2049  nfs

    100021    1   udp  34369  nlockmgr

    100021    3   udp  34369  nlockmgr

    100021    4   udp  34369  nlockmgr

    100021    1   tcp  56195  nlockmgr

    100021    3   tcp  56195  nlockmgr

    100021    4   tcp  56195  nlockmgr

```

On my Ubuntu machine, I mount the share like so:

```
UBUNTUMACHINE-B # mount MACHINE-A:/storage/ /nfs/
```

Then, I am able to see directories music, photos and mp3 when I do

```
UBUNTUMACHINE-B # ls /nfs/
```

but when I get into one of the directories, I don't see any files. I suspect this is a file permissions issue, but how do I go about fixing this?

----------

## krinn

because you are mounting them as nfsv4, while your export is valid for nfsv3, it is not for nfsv4, where first directory is your root directory, and then any directories in it must appears with their own rules (i'm still speaking about nfsv4). It's not really even valid for nfsv4, root directory must have fsid=0 but last time i check, if i'm not wrong, nfs was applying it to the first one it see if none with fsid=0 could be found.

imo, it's a design fault, they should have enforce strict format when using an nfsv4 server for exports, and force an nfsv2/3 export inside it to respect the v4 design.

make sure your ubuntu is mounting them as nfsv3, i suppose it works like in gentoo, add -o nfsvers=3 and try add the -v to see what is going on

remember that even you are using nfs as mount option, nfs might not be equal to nfs4 per default (as it is not the case in gentoo), and it's even simplier for your case, you didn't tell the server what version to use, so server decide what version to provide.

and your gentoo server is able to do nfsv4, so if anyone ask a default nfs sharing, your server will provide v4 first, and if your client accept it, all nfsv4 rules will be applied.

And gave your directories the nohide option (and not only to your root directory), if your client is nfsv3 only (i know 0 about ubuntu), the nohide should be enough for your problem.

----------

## dylanthomasfan

Thanks for your response, krinn, but it happens to be a rather silly error on my part. I have now resolved the problem, and I see the remote files on the client exactly with the same permissions etc. The key idea is that each mount point gets an export--at least that's how I re-cast the exports and now I see all the files. Let me explain.

On MACHINE-A, I have the following mount points:

```

/dev/sdb1           /storage/music

/dev/sdb2           /storage/mp3

/dev/sdb3           /storage/photos

```

Now, the /etc/exports file should read

```

/storage/music/   10.10.1.4(async,ro,no_subtree_check,all_squash,anonuid=1000,anongid=1000)

/storage/mp3/   10.10.1.4(async,ro,no_subtree_check,all_squash,anonuid=1000,anongid=1000)

/storage/photos/   10.10.1.4(async,ro,no_subtree_check,all_squash,anonuid=1000,anongid=1000)

```

You will note that earlier, I was (incorrectly) exporting /storage like so:

```
/storage/    10.10.1.4(async,ro,no_subtree_check,all_squash,anonuid=1000,anongid=1000) 
```

I have the same user with the same UID/GID on both machines, so I don't need the anonuid and anongid clauses in the exports.

I think it is easy to make this mistake, so I wanted to post this resolution to help other folks. Thanks for your time.

----------

