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 have a shared directory on a server - let's call it /home/shared - which is mounted with content from another server via nfs.

When it is unmounted /home/shared is supposed to be empty - however, running du -x on the directory indicates that it is not empty.

I cannot unmount the NFS content to inspect the mount point, since it is in use by others.

Is there any way that I can view/edit the contents of the actual mount point (not the NFS content) while leaving the NFS content mounted for others to use?

share|improve this question
add comment

4 Answers

If you want to get a handle into the underlying directory, you could use mount --move to move the share out of the way, cd into the mountpoint, then use mount --move to move it back into place. Shouldn't disrupt anything.

A better option if you just want to view would be to use debugfs (or other equivalent) against the filesystem device itself to check that directory:

challenger:/home/michael # mount
/dev/mapper/system-opensuse on / type ext3 (rw,noatime)
/dev/mapper/system-home on /home type xfs (rw,noatime)
challenger:/home/michael # debugfs /dev/system/opensuse 
debugfs 1.41.9 (22-Aug-2009)
debugfs:  ls /home
 11751  (12) .    2  (4084) ..
debugfs:  quit
share|improve this answer
add comment

It might be easier to:

$ sudo mount --bind /directory_above_the_mount_point /some_temporary_directory

then, the /directory_above_the_mount_point/mount_point remains to show the mounted filesystem and at the same moment you can access the underlying filesystem (mount point) at /some_temporary_directory/mount_point.

share|improve this answer
add comment

You can move a mount in Linux using mount --move. So if you're OK with a very short window of possible non-accessibility, you could do this:

  1. Make a new temporary directory: mkdir /home/shared-tmp
  2. Do the move: mount --move /home/shared /home/shared-tmp && mv /home/shared /home/shared-old && mkdir /home/shared && mount --move /home/shared-tmp /home/shared
  3. Remove the temporary directory: rmdir /home/shared-tmp

This should leave /home/shared as the mounted directory, /home/shared-old as the old (suspected non-empty) directory.

share|improve this answer
    
As that would prevent other users from accessing the NFS data where they expect to find it, this is not an option. –  Brent Apr 8 '10 at 17:26
add comment

you can mount the device on which your original files reside to another directory then drill down into to get to the contents of the directory.

share|improve this answer
add comment

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.