Under Development
Overview
In this guide you will learn to share storage using different protocol.
Share Storage using NFS
NFS is a Distributed File system protocol, it is used to share server's storage remotely to other server. On the client server, we add that NFS storage to read, write files from the shared storage.
Configure NFS on server
1. Install Packages
In order to use NFS on server we need to install nfs-kernel-server on ubuntu or nfs-utils on centos.
yum install -y nfs-utils
systemctl enable --now nfs-server
# FOR AlmaLinux/Rocky Linux
dnf install -y nfs-utils
systemctl enable --now nfs-server
# FOR UBUNTU 22.04 or 24.04
apt update
apt-get install -y nfs-kernel-server
systemctl enable --now nfs-server
2. Create NFS Export Directory
Create a directory that needs to be shared among the client servers.
3. Change Permissions of Directory
We change the permission of the directory so that the client server can easily access the directory without ant restriction.
chmod 777 /xyz
4. Allow Client IPs to access the NFS Storage
In order to access the NFS storage you need to add Client Ips in /etc/exports.
Add IPs that you want to allow access.
5. Export the NFS directory
In order to access the NFS storage you need to add Client Ips in /etc/exports.
6. Allow NFS via firewall
To allow NFS on firewalld :
firewall-cmd --reload To allow NFS through the firewall, execute:
To allow NFS through the firewall, execute:
Configure NFS Client on server
1. Install the NFS Common package on Client Server
In order to access nfs storage on Client System you need to install some packages on the client server. Below commands installs them.
yum install -y nfs-utils nfs4-acl-tools
# FOR AlmaLinux/Rocky Linux
dnf install -y nfs-utils nfs4-acl-tools
# FOR UBUNTU 22.04 or 24.04
apt-get install -y nfs-common
2. Create a mount point on NFS Client Server
Create a directory on the Client system to mount the NFS share.
3. Mount nfs share on Client System
You can mount NFS share using the mount command, but the NFS storage will not be mounted on reboot. To mount the NFS share on boot add an entry in /etc/fstab.
Client_ip:/xyz/data /nfs_share nfs defaults 0 0
In order to mount NFS as NFSv3 version you need to added vers parameter to the to the commands.
Client_ip:/xyz/data /nfs_share nfs defaults,vers=3 0 0