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.

I have two dedicated servers both running CENTOS 5. Both can connect using a local IP to one another. I need one server to have direct file access to certain directories on the other server.

Is there a way to mount, say, the /usr/ directory of one server to the other so it can access files directly?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

From one system you will need to export the /usr filesystem and on the other system you will need to mount the remote /usr using NFS.

To export the filesystem you will need to make an entry in the /etc/exports file and then run the /usr/sbin/exportfs program to allow it to be accessed.

Once the /usr has been exported you can use mount to mount it into the local filesystem. If you have systema exporting it's /usr and systemb is to mount it then

/etc/exports would have an entry like this

/usr     systemb(rw)

and

exportfs -a

would make the /usr available to systemb so

mount systema:/usr /mnt

would mount /usr into the systemb filesystem at /mnt

If you want the systema:/usr filesystem to be mounted at boot then you'll need to add an entry to /etc/fstab e.g.

systema:/usr      /mnt        nfs        defaults    0 0 
share|improve this answer
1  
Great. A combination of the two worked perfectly. Couple things I ran into along the way in-case anyone else has the same question: Both NFS and Portmap need to be running on both servers. /sbin/service portmap start /sbin/service nfs start chkconfig portmap on chkconfig nfs on Then I modified the /etc/exports on the root server /directory systemhost/ipaddress(rw) Then finally mounted on the secondary server mount -t nfs host:/directory /localdirectory –  Thenayr Dec 1 '10 at 23:03

For this, you'll want to use NFS. Essentially, you'll edit /etc/exports, and put in the file system you want to share to another server, along with any options. (Read only? Read Write? Allow root access?) Then run exportfs, and mount that directory from the other server. You'll want to read man exports for the syntax and options. man exportfs & man nfs will help too.


--Christopher Karel

share|improve this answer

Exporting using NFS on the server side works great. On the client side I like to enable automounting. Make sure the file auto.master includes a line that looks like; /net -hosts

Use 'service autofs start' to start the service.

Then on the client 'cd /net/systema/usr' takes you into the NFS exported files.

One advantage of the automounter vs editing /etc/fstab is that you can reboot the systems in any order.

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.