Linux: Shared and mounted directories

1

Fairly-new to Linux and am trying to see if I can start getting a little clever. I have a server that contains files that I'd like to have "locally" accessible on other servers directly under the / directory:

Server1
    /opt/
        fizz/
            buzz/ --> the directory that contains interesting stuff

Server2
    /opt/
    /buzz/ --> references the Server1/opt/fizz/buzz/ directory

I spent some time reading up on this and I stumbled across all sorts of terms like "shared directories", "mounted drives", "mounted directories", etc.

What is the best solution for what I need? Essentially, the contents in this buzz/ directory are huge and would be very expensive to query Server1 for every time I want them on another server. It would be nice if each server had a local link to that directory as if the directory was stored locally, right there on the server.

Thanks in advance!

pnongrata

Posted 2012-02-20T15:40:19.830

Reputation: 2 212

Answers

1

I think

[it] would be very expensive to query Server1

and

it would be nice if each server had a local link to that directory as if the directory was stored locally

are contradictory. The former implies that you think a network mount would not be feasible in your environment. The latter implies that you want the only set of data on Server1 and that don't want to rsync seperate copies between locations.

This is a nice article on NFS, how it works, how to set it up, and its security. I think you'll find that a network share via NFS will be perfectly acceptable.

Christopher Neylan

Posted 2012-02-20T15:40:19.830

Reputation: 701

0

If you really want to have local copies, rsync the directories from server1 to the other ones. But you need to have a concept how to deploy changes made on server2 to server1. on the other hand, do you rellay know (e.g., you benchmarked it) that your nfs access would be slow or dou you feel (there is sth in your stomach) it'll be slow?

However rsync example four you:

rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/ 

tuergeist

Posted 2012-02-20T15:40:19.830

Reputation: 300

0

How huge is huge?

The traditional way to do this is put /opt/fizz/buzz into Server1's /etc/exports file and restart NFS to export it, then "mount Server1:/opt/fizz/buzz /buzz" on server2.

pjc50

Posted 2012-02-20T15:40:19.830

Reputation: 5 786