I have two Ubuntu servers. One of them has a directory with data. I want this directory to be visible (and writable) by the second server. How can I do this? What tool to use?
Asked
Active
Viewed 9.5k times
7
-
3If only this didn't exist; http://blog.stackoverflow.com/2012/07/kicking-off-the-summer-of-love/?cb=1 ... You already have the NFS tag in your question, have you thought of doing any form of basic self-help so far, maybe looking up what NFS is and how it's used, it's very simple basic stuff that professional sysadmins really could do with knowing – Chopper3 Jul 24 '12 at 10:39
1 Answers
29
On the 'server' add an entry into your /etc/exports
to share the directory e.g.
/directory/with/data secondserver.tld(rw)
which allows secondserver read/write access to the directory/with/data
then use exportfs to share the directory
exportfs -r
and you can verify your export with
exportfs
/directory/with/data secondserver.tld
You can now mount your directory on secondserver
mount server:/directory/with/data /mnt
and you can verify the mount
mount -t nfs
server:/directory/with/data on /mnt type nfs (rw,addr=192.168.254.196)
You may want to add an entry to your fstab to have it mount on boot too
server:/directory/with/data /mnt nfs rw 0 0
You'll probably want to read the various man pages I linked to too.

user9517
- 115,471
- 20
- 215
- 297
-
Note: I needed to restart the first server after installing exportfs and running exportfs -r. – assylias Jul 28 '16 at 17:03
-
1