How to configure NAS using NFS on CentOS

NFS (Network File System) is a network file system protocol originally developed by Sun Microsystems in 1984, NFS allows clients to access files over the network in the same way as when accessing local storage. NFS is built on Open Network Computing Remote Procedure Call (ONC RPC) system.
NFS (Network File System) has several versions, namely:
NFS v2: version 2 was originally only uses UDP protocol and can only be allowed to read files of 2GB.
NFS v3: It supports TCP protocol and added several features that can be used to read the file more than 2GB, such as support for 64-bit offset. TCP is added in version 3 is to improve data transfer speeds on the WAN, because if you use UDP data transfer process tends to be slow.
NFS v4: Version 4 is more emphasis on security features and support for clustering as well as access to NFS in parallel over the network. Currently, the NFS version 4 is the latest version.
This article described “how to configure a NAS (Network Attach Storage) using CentOS and NFS v3, follow this step:
CentOS installation using minimal installation mode, can be read in the post “Installing CentOS minimal mode”

If the internet connection is quite large> 512 / if patiently waiting for her please update CentOS:

$ sudo yum update -y $ Sudo yum-y update

Install NFS Install NFS

$ sudo yum install nfs* $ Sudo yum install nfs *

Create a directory to be used or accessed by the client, here I make the partition “/ data” as the drive used for storage servers:

$ sudo mkdir /data/node1 $ Sudo mkdir / data/node1
$ sudo chmod -R 777 /data/node1 $ Sudo chmod-R 777 / data/node1

Kemudian setting hak akses network ke NFS server, untuk parameter seperti ini “/path-server      ip-network-allowed(privileges)” Then setting network access rights to the NFS server, for the parameter like this “/ path-server ip-network-allowed (privileges)”

$ sudo vi /etc/export $ Sudo vi / etc / export
/data/node2,sync,no_subtree_check) / Data/node2 (rw, sync, no_subtree_check)

Eksport hasil konfigurasi diatas: Export results above configuration:

$ sudo /usr/sbin/exportfs -avr $ Sudo / usr / sbin / exportfs-avr
$ sudo /etc/init.d/portmap restart $ Sudo / etc / init.d / portmap restart
$ sudo /etc/init.d/nfs restart $ Sudo / etc / init.d / nfs restart
$ sudo /sbin/chkconfig –level 35 portmap on $ Sudo / sbin / chkconfig-level 35 portmap on
$ sudo /sbin/chkconfig –level 35 nfs on $ Sudo / sbin / chkconfig-level 35 nfs on

For a security feature can use permissions in the “hosts.allow”:

$ sudo vi /etc/hosts.allow $ Sudo vi / etc / hosts.allow
portmap:, portmap:,

Then the client side that needs to be done is to install the client nfs and portmap. Portmap is used in the NFS version 3 but version 4 does not need it because it can use the authentication method. I use CentOS 5.5 as client:

$ sudo yum install nfs $ Sudo yum install nfs
$ sudo yum install portmap $ Sudo yum install portmap
$ sudo /etc/init.d/portmap start $ Sudo / etc / init.d / portmap start
$ sudo /sbin/chkcongfig –level 35 portmap on $ Sudo / sbin / chkcongfig-level 35 portmap on

Check if the export on the NFS server is working and see also the right aksesya:

$ sudo showmount -e nas-server $ Sudo showmount-e nas-server
Export list for nas-server: Export list for nas-server:
/data/node1 / Data/node1

Okay, then mount to a local directory (client), but first create a local directory that will be used as a mount point to the NAS, be careful if you use the following options, because the local directory under / (root partition), then if the mountin to loose nas then all activity data from the client will be write to local directory (/ mynas) so that if a small root partition rather risky. Saya sendiri menggunakan partisi / (root) hanya berkisar antara 8-10GB saya tetap melakukan mounting dengan local directory dibawah root :D, like this: I myself use a partition / (root) only ranges between 8-10GB I want to do with mounting a local directory under the root: D, like this:

$ sudo mkdir /mynas $ Sudo mkdir / mynas
$ sudo mount nas-server:/data/node1 /mynas $ Sudo mount nas-server: / data/node1 / mynas
$ df -h $ Df-h
Filesystem            Size  Used Avail Use% Mounted on Filesystem Size Used Avail Use% Mounted on
/dev/md1              9.5G  691M  8.3G   8% / / Dev/md1 9.5G 691M 8.3G 8% /
/dev/md7              292G   86G  192G  31% /home / Dev/md7 292G 86G 192G 31% / home
/dev/md6               95G   32G   59G  35% /backup / Dev/md6 32g 95G 59G 35% / backup
/dev/md5              2.0G  170M  1.7G  10% /tmp / Dev/md5 170m 2.0G 1.7G 10% / tmp
/dev/md3               38G  3.6G   33G  10% /var / Dev/md3 33g 38G 3.6G 10% / var
/dev/md2               15G  3.9G  9.7G  29% /usr / Dev/md2 15G 3.9G 9.7G 29% / usr
/dev/md0              243M   24M  207M  11% /boot / Dev/md0 243M 207M 24m 11% / boot
tmpfs                 2.0G     0  2.0G   0% /dev/shm tmpfs 2.0G 0 2.0G 0% / dev / shm
nas-server:/data/node1      857G  696G  117G  86% /mynas nas-server: / data/node1 857G 696G 117G 86% / mynas

Here the process of setting and configuration of NAS with NFS server has been completed, may be useful:)


Installasi NAS menggunakan NFS di CentOS

NFS (Network File System) adalah sebuah protokol file sistem jaringan yang awalnya dikembangkan oleh Sun Microsystem pada tahun 1984, NFS memungkinkan klien untuk mengakses file melalui jaringan dengan cara yang sama seperti pada saat mengakses penyimpanan di lokal. NFS dibangung diatas Open Network Computing Remote Procedure Call (ONC RPC) system. Continue reading “Installasi NAS menggunakan NFS di CentOS” »