Flipkart

Wednesday, June 20, 2018

NFS – Folder mapping – Autofs

Create a shared folder on one server and map this to multiple servers.

Uses nfs, autofs tools.

This works on most Linux flavors.

Scenario:-

Server1 – Create folder /SharedFolder, share this over network, and map this to Server2, Server3.

Steps:-

Server1## mkdir /sharedfolder

Server1## vi /etc/exports

/sharedfolder Server2(rw,no_root_squash) Server3(rw,no_root_squash)

Server1## chkconfig –levels 345 nfs on

Server1## service nfs restart

Server1## exportfs

Server2## vi /etc/auto.master

#Comment all the lines with # as first character’s and add these lines

/- /etc/auto.direct

+auto.master

Server2## vi /etc/auto.direct

/mnt/sharedfolder -fstype=nfs,rw,soft,intr Server1:/sharedfolder

Server2## chkconfig –levels 345 autofs on

Server2## service autofs restart

[comment- network folder is mounted to /mnt/sharedfolder directory. No need to create sharedfolder directory under /mnt on server2##, it will get created automatically from network mount. ]

Server3## Proceed the same like Server2## to mount it.

mount -t nfs 112.168.171.231:/New/mount /New/mount

# mount 162.168.112.8:/usr/eams/sharedsync/interfaces /usr/eams/sharedsync/interfaces

clip_image001

No comments:

Post a Comment