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.

On server1, we had an NFS share mounted from server2 like this:

/nfs/server2/share

Recently, we took down server2 to install a new OS on it. Now we can't get NFS setup the way it was. When I do this:

ls -l /nfs/server2

and it's empty. So therefore I cannot mount my share at /nfs/server2/share.

When I try to create /nfs/server2/share directory, I get

mkdir: cannot create directory `share': No such file or directory

I think this is because it doesn't really think the /nfs/server2 directory really exists. Even if I use the -p option with mkdir, it doesn't work.

Next I tried to remove /nfs/server2 so I could just recreate it. I try to rm -r /nfs/server2 but I get

rm: cannot remove directory `/nfs/server2': Device or resource busy

So now I'm at a loss. I need to mount this NFS share in the same exact place on server1 (at /nfs/server2/share) because other software on server1 depend on this. But if I can't create that share directory and I can't remove that directory, what do I do?

Also, just for testing, I attempted to mount the share at /nfs/testing/share and it mounted just fine. But like I said, I need to mount it back in the same location.

UPDATE

The server2 is not mounted in any way on server1. I think that the problem started when another admin took down server2 to reinstall the OS without first unmounting the share on server1. I'm not sure if that makes a difference or not. In any case, mount | grep server2 shows nothing and there is nothing in fstab.

SOLVED

Apparently automount was running on server1 and that service was keeping me from deleting that old NFS directory. Lack-of-communication-between-sysadmins FTL...

I suppose that the way to solve this problem would have been to grep for some process or service that is using that directory I tried to delete. But I don't know how to do that.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

For future reference, the mount --move switch is very useful to move a misbehaving mount out of the way. See also the umount -l option.

share|improve this answer

you can find out what processes are using what files with lsof.

You will need to run this as root to access all the information about processes on your machine.

Unix treats almost everything as files , so you can also get a list of network resources in use.

try

lsof | grep TCP

a great diagnostic tool!

share|improve this answer

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.