NFS on centos

It’s been a long time I’m not using NFS.

Today i need to generate a backup for web and mysql, so preferable i save this backup to another HDD on the others place.

Then NFS come out on my head. So here is the simple step to mount network drive for your CENTOS box using NFS

Server IP : 172.31.0.1
Client IP : 172.31.0.2

On the Server
1. Create backup folder
[quote]
mkdir /backup
[/quote]

2. Edit /etc/exports
[quote]
vi /etc/exports
[/quote]
add this line
[quote]
/home/sharing 172.31.0.2/255.255.255.255(rw,sync)
[/quote]

3. Edit /etc/hosts.allow
[quote]
vi /etc/hosts.allow
[/quote]
add this line
[quote]
portmap: 172.31.0.0/255.255.255.0
[/quote]

4. Restart NFS and portmap
[quote]
/etc/init.d/nfs restart
/etc/init.d/portmap restart
[/quote]

On the Client
1. Start portmap
[quote]
/etc/init.d/portmap start[quote]
[/quote]

2. Edit /etc/fstab and add this line
[quote]
vi /etc/fstab
172.31.0.1:/backup /mnt/backup nfs rw,hard,intr 0 0
[/quote]

3. mount the nfs
[quote]
mount 172.31.0.1:/backup /mnt/backup
[/quote]

If you r using CSF as firewall make sure add your server ip address on /etc/csf/csf.allow.

That’s all.

This article was written by matn0t.