Thursday, 8 January 2009

NFS mount a remote directory with solaris

Let's say we have a directory /hiro on server nakamura, which we need to mount as directory /claire on server bennet. We're going to assume that both servers are aware of the other by name (either as an entry in the /etc/hosts file, or dns, etc.) - but if not, you can replace the server names by ip addresses.

If this is a one-off requirement, then on nakamura, we issue the command:
share -F nfs -o rw,public,anon=root /hiro

This will make the directory /hiro available for nfs-mounting.

On bennet, we issue the command:
mount -F nfs nakamura:/hiro /claire

This will make the /hiro directory from nakamura available as the /claire directory on bennet.

However, all of this is transient, and will be lost on a reboot. To make this permanent, edit /etc/nfs/dfstab on nakamura, and add the line:

share -F nfs -o rw,public,anon=root /hiro

You can now share the directory as before, or by the command shareall

On bennet, edit /etc/vfstab and add in the line:

nakamura:/hiro - /claire nfs - yes rw,hard,bg

You can now mount the directory as before, or by the command mount -a, or mount /claire

No comments: