Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I created a nfs share entry

mzhu@zeus:/share$ cat /etc/exports
/share  *(rw,async,insecure)

From the local file system, execute 'ls -al' in /share. The output is

mzhu@zeus:/share$ ls -al
total 20
drwxrwxrwt  5 mzhu mzhu 4096 May 23 15:12 .
drwxr-xr-x 25 root root 4096 Nov  6  2013 ..
-rw-rw-r--  1 mzhu mzhu    0 May 23 15:12 1
drwxrwxr-x  2 mzhu mzhu 4096 May 23 15:12 2
drwxrwxr-x  8 mzhu mzhu 4096 May 21 16:53 build
drwxr-xr-x 54 mzhu mzhu 4096 May 21 19:15 team

Then I mount the nfs share to ~/test in the same machine. The mount output is (I only remove the IP info)

zeus:/share on /home/mzhu/test type nfs (rw,vers=4,addr=x.x.x.x,clientaddr=x.x.x.x)

Frome the NFS, execute 'ls -al'. The output is:

mzhu@zeus:~/test$ ls -al
total 20
drwxrwxrwt  5 mzhu mzhu 4096 May 23 15:12 .
drwxr-xr-x 32 mzhu mzhu 4096 May 23 15:30 ..
-rw-rw-r--  1 mzhu mzhu    0 May 23 15:12 1
drwxrwxr-x  2 mzhu mzhu 4096 May 23 15:12 2
drwxr-xr-x  2 root root 4096 Oct 20  2013 build
drwxr-xr-x  2 root root 4096 Oct 21  2013 team

Compare the 2 outputs, you will find, in local file system, the time stamp and permission of 'build' is

drwxrwxr-x  8 mzhu mzhu 4096 May 21 16:53 build

while in nfs share (even the same machine), the time stamp and permission of 'build' is

drwxr-xr-x  2 root root 4096 Oct 20  2013 build

They have different permissions, owner, group, and time stamp.

Is there anyone who can tell me why the difference? Or tell me how to debug/troubleshoot this issue?

P.S. When I created the nfs share in the first time, the system date/time is Oct 2013 but I've adjust the date/time and reboot the machine.

The Ubuntu release info:

mzhu@zeus:/share$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.2 LTS
Release:        12.04
Codename:       precise

RPCINFO:

mzhu@zeus:~/test$ rpcinfo -p localhost
   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  54306  status
    100024    1   tcp  48737  status
    100021    1   udp  42616  nlockmgr
    100021    3   udp  42616  nlockmgr
    100021    4   udp  42616  nlockmgr
    100021    1   tcp  55986  nlockmgr
    100021    3   tcp  55986  nlockmgr
    100021    4   tcp  55986  nlockmgr
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049
    100227    3   tcp   2049
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049
    100227    3   udp   2049
    100005    1   udp  59947  mountd
    100005    1   tcp  46390  mountd
    100005    2   udp  38311  mountd
    100005    2   tcp  57959  mountd
    100005    3   udp  55855  mountd
    100005    3   tcp  50799  mountd

EDIT:

mzhu@zeus:/share$ mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sdb1 on /share/build type ext4 (rw)
/dev/sdc1 on /share/team type ext4 (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
cpddae:/cpddae/images on /mnt/cpddae type nfs (rw,addr=x.x.x.x)
gvfs-fuse-daemon on /var/lib/lightdm/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=lightdm)
x.x.x.x:/share on /mnt/share type nfs (rw,addr=x.x.x.x)
nfsd on /proc/fs/nfsd type nfsd (rw)
zeus:/share on /home/mzhu/test type nfs (rw,vers=4,addr=x.x.x.x,clientaddr=x.x.x.x)
share|improve this question

2 Answers 2

The difference in the owner is due to different UID and GID. If you don't have the same UID for mzhu in both systems, on the share it will drop to root.

share|improve this answer
    
I don't use 2 systems. I mount the nfs share locally, so the UID and GID should be same. –  Landy May 29 '13 at 1:23

Can you show us the output of mount? This is the expected behaviour if you have further filesystems at /share/build and /share/team -- the local ls will see the mounted filesystem, the NFS client will see only the mountpoint directories. To get the same view, you need to also share the lower filesystems and mount them on clients.

EDIT: The mount output that you've added confirms my hypothesis: there are three volumes here, /share is part of sda1, /share/build is sdb1 and /share/team is sdc1. The date was apparently October 2013 when you created the mount points on sda1 for sdb1 and sdc1, but now that you've mounted over them you can no longer see those directories from the local system. On the NFS client, however, the extra volumes aren't mounted and you can see the original mount points. You can explore this more yourself by creating files and directories in /home/mzhu/test/build — they won't show up in /share/build, but will instead use space from sda1.

share|improve this answer
    
I've edited the original post and added the complete output of mount. Thanks. –  Landy May 29 '13 at 1:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.