How to Mount File System in Linux?

Consider there is a host server (Main Host – 172.1.1.1) with a file system.
Now the requirement is to mount the file system across another server (Server1 – 172.1.1.5).

Follow the steps below.

1. Log-in to the Server (Main Host – 172.1.1.1) which hosts file system, as root user

2. Check the Mount points available

$ showmount –a
All mount points on main-vs-ora-1.abc.com:
172.1.1.1:/opt/stp1/files

3. Open exports file

$ vi /etc/exports
/opt/stp1/files *.*.*.*(rw,no_root_squash,insecure)

4. Add entries to the above file, if any other path has to be mounted

5. Lets add the opt path as follows, so the exports file look as follows

$ vi /etc/exports
/opt/stp1/files *.*.*.*(rw,no_root_squash,insecure)
/opt/stp1/files/opt *.*.*.*(rw,no_root_squash,insecure)

6. Check nfs status.

$ service nfs status
rpc.mountd (pid 32501) is running...
nfsd (pid 32498 32497 32496 32495 32494 32493 32492 32491) is running...
rpc.rquotad (pid 32486) is running...

7. Restart nfs

$ service nfs restart

8. Log-in to the server where the file system has to be mounted (Server1 – 172.1.1.5)

9. Check whether you are able to ping the host server (file server)

[root@server1-stp-dev-1 /]# ping 172.1.1.1
PING 172.1.1.1 (172.1.1.1) 56(84) bytes of data.
64 bytes from 172.1.1.1: icmp_seq=1 ttl=63 time=1.06 ms

10. If you are not able to ping the file server then open the following file

$ vi /etc/hosts

Add the following entry

172.1.1.1 main-vs-ora-1.abc.com main-vs-ora-1

11. Check the mount options available from file server

[root@ server1-stp-dev-1 /]# showmount -e 172.1.1.1
Export list for 172.1.1.1:
/opt/stp1/files     *.*.*.*
/opt/stp1/files/opt *.*.*.*(rw,no_root_squash,insecure)

12. mount the /opt directory using the following command

mount 172.1.1.1:/opt/stp1/files/opt /opt/

13. Now open the opt directory

$ cd /opt

Now you should be able to see the files mounted from host server (/opt/stp1/files/opt/)

14. To un mount the file system use the following command

$ umount /opt

15. Repeat the same procedure for all servers.

Search