Rails Machine Wiki

Setting Up NFS

If you have multiple servers, you may want to set up NFS to share files between them or to cross backup. On each of the clients, you’ll want to use autofs to automount the shared directories after a reboot.

On the server (the one sharing directories)

yum install nfs-utils portmap autofs

Edit /etc/exports and permit sharing. Use the private address of the client, which you can check with ifconfig eth1.
Add one line like this for each client.

/path/to/share          10.0.x.x(rw,async,all_squash,anonuid=596,anongid=596)

Then start the services

chkconfig portmap on
chkconfig nfslock on
chkconfig nfs on

service portmap start
service nfslock start
service nfs start

On each client

We’re going to mount the shared directory at /backup/assets

yum install nfs-utils portmap autofs
chkconfig autofs on
chkconfig portmap on
chkconfig nfslock on

service portmap start
service nfslock start
mkdir -p /backup/assets

#Put this in /etc/auto.master:
/backup /etc/auto.backup --timeout=60

#Put this in /etc/auto.backup (using the server's private address):
assets    -rw,soft,intr,rsize=8192,wsize=8192       10.0.x.x:/path/to/share

service autofs start
cd /backup/assets

User Submitted Notes

I used the id of one of my regular users (the deploy user — user id 500, found in /etc/passwd) to enable the ability to create and write to files in the share:


/path/to/share         10.0.x.x(rw,async,all_squash,anonuid=500,anongid=500)