Follow the instructions below to successfully mount a storage server on another VPS using NFS.
1. Actions on the Storage Server Side
1.1. Install NFS Packages
yum install nfs-utils nfs-utils-lib -y
1.2. Edit Configuration
Edit the NFS configuration file:
nano /etc/sysconfig/nfs
Uncomment and edit the following lines:
MOUNTD_NFS_V3="yes"
RPCNFSDARGS="-N 4"
NFSD_MODULE="noload"
1.3. Start Services
Enable and start the necessary services:
chkconfig nfs on
service rpcbind start
service nfs start
1.4. Edit Exported Directories
Edit the exports file to specify the directories to be shared:
nano /etc/exports
For example, to add the /home
directory (replace VPS_IP
with the IP address of the VPS):
/home VPS_IP(rw,sync,no_root_squash,no_subtree_check)
Export these settings:
exportfs -a
2. Actions on the VPS Side
2.1. Install NFS Packages
yum install nfs-utils nfs-utils-lib -y
2.2. Create Mount Point
Create a directory to mount the NFS share:
mkdir -p /mnt/nfs/home
2.3. Mount the NFS Share
Mount the NFS share (replace STORAGE_SERVER_IP
with the IP address of the storage server):
mount STORAGE_SERVER_IP:/home /mnt/nfs/home -o nolock
3. Verify the Mount
Check the mounted filesystem:
df -h
You should see output similar to this:
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 40G 1.4G 39G 4% /
none 2.0G 4.0K 2.0G 1% /dev
none 512M 0 512M 0% /tmp
STORAGE_SERVER_IP:/home 40G 828M 40G 3% /mnt/nfs/home
4. Unmount the NFS Share
To unmount the NFS share, use the following command:
umount /mnt/nfs/home
By following these steps, you can successfully mount a storage server on another VPS using NFS on CentOS.