21 Temmuz 2014 Pazartesi

Sharing files and folders with NFS between Linux machines RHEL 6


10.150.3.70 ve 10.150.3.71 WAS test sunucuları



Her iki sunucuda da :

Yazılım kullanıcılarını tanımlamak için wasusers grubu oluşturuldu. groupadd wasusers
WAS yöneticisi için wasadmin kullanıcısı ve grubu zaten oluşturulmuştu.
/home dizininin altına wasadmin kullanıcısına ve grubuna bütün yetkiler verildi.
setfacl -R -m u:wasadmin:rwx /home
setfacl -R -m g:wasadmin:rwx /home
mkdir /home/nfsshare
chown -R wasadmin:wasadmin nfsshare/
setfacl -R -m g:wasusers:rwx nfsshare





http://www.tecmint.com/how-to-setup-nfs-server-in-linux/

NFS Server : 10.150.3.70
NFS Client : 10.150.3.71

Setting Up the NFS Server:

nfs paylaşımı için NFS server olarak kullanılacak makine de (10.150.3.70):
service nfs start
chkconfig nfs on

For sharing a directory with NFS, we need to make an entry in “/etc/exports” configuration file.
Here I’ll be creating a new directory named “nfsshare” in “/home” partition to share with client server, you can also share an already existing directory with NFS.

vi /etc/exports
/home/nfsshare   10.150.3.71(rw,sync,no_root_squash)

there is a directory in /home partition named “nfsshare” is being shared with client IP “10.150.3.71” with read and write (rw) privilege

service nfs stop
service nfs start



Setting Up the NFS Client :

After configuring the NFS server, we need to mount that shared directory or partition in the client server.
Now at the NFS client end, we need to mount that directory in our server to access it locally.
To do so, first we need to find out that shares available on the remote server or NFS Server.

[root@test2was855 /]# showmount -e 10.150.3.70
Export list for 10.150.3.70:
/home/nfsshare 10.150.3.71
[root@test2was855 /]#


To mount nfsshare ;

[root@test2was855 home]# mount -t nfs 10.150.3.70:/home/nfsshare /home/nfsshare
[root@test2was855 home]#

Verify nfsshare directory is mounted ;

[root@test2was855 nfsshare]# mount | grep nfs
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
10.150.3.70:/home/nfsshare on /home/nfsshare type nfs (rw,vers=4,addr=10.150.3.70,clientaddr=10.150.3.71)


The above mount command mounted the nfs shared directory on to nfs client temporarily,
to mount an NFS directory permanently on your system across the reboots, we need to make an entry in “/etc/fstab“.

vi /etc/fstab

Add the following new line as shown below.

10.150.3.70:/home/nfsshare /home/nfsshare  nfs defaults 0 0

If you want to unmount that shared directory from your server after you are done with the file sharing,
you can simply unmount that particular directory with “umount” command. See this example below.

[root@test2was855 nfsshare]# df -h -F nfs
Filesystem                  Size  Used Avail Use% Mounted on
10.150.3.70:/home/nfsshare   24G   14G  8.4G  63% /home/nfsshare
[root@test2was855 nfsshare]#

root@nfsclient ~]# umount /home/nfsshare

After umount check again :
[root@test2was855 nfsshare]# df -h -F nfs

Hiç yorum yok:

Yorum Gönder