1

I am working on two virtual machines, running Ubuntu 14.04. So, one VM is the server and the other the client. Here's what I've done till now:

Server VM:

sudo apt-get install nfs-kernel-server

sudo nano /etc/exports

I added:

/home/mnt_dir *(rw,sync)

sudo chmod 777 /home/mnt_dir

service nfs-kernel-server restart 

Client VM:

sudo apt-get install nfs-common

sudo mount -v -t nfs server_ip:/home/mnt_dir /home/mnt_dir

and everything works fine. Then I need to unmount them so I run the command on the client VM:

sudo umount -l /home/mnt_dir/

Just to be sure I run the above command again and the output message is

umount: /home/mnt_dir: not mounted

The problem is that although I get the above message, changes on the one VM still apply to the other VM, like the directories are still mounted. Why is this happening?

edit: I noticed that in order to mount/umount work properly, I need to run a simple cd command. Any ideas about that?

1 Answers1

2

I noticed that in order to mount/umount work properly, I need to run a simple cd command. Any ideas about that?

If you are currently in a directory that is within a mounted filesystem and you try to unmount it, you normally get an error message that the fielsystem is busy the effect of this is it can't be unmounted e.g.

$ umount: /mnt/data: device is busy

Note what the documentation says about unmount -l it is important.

When you issue a cd command with no parameters it has a special meaning (which you can look up in the documentation).

The upshot of the cd command is that the filesystem becomes not busy and can be unmounted.

user9517
  • 114,104
  • 20
  • 206
  • 289