Search code examples
javalinuxunixfile-uploadfile-sharing

Mounting a networked folder on Linux System for Storing Files?


I have two RHEL linux server and the problem that I have is that I am not aware of how to use the other one as a file storage server. Consider there are two servers A & B, now I want server A to have a folder that is mapped to the Server B and then whenever I store something on server A it automatically is moved to server B. I think this is called Networked Drive or May be Mounting a networked folder or File Server. I am totally unaware of this. Please help me to figure this out. Since the server B has a huge storage capacity and I want to save all the files in this through a Java EE program running on Server A.

Please let me know any tools or technology that can help in this.


Solution

  • Consider using nfs to mount remote filesystem on a server.

    On server B, you may set /etc/exports as follows:

    # See exports(5) for a description.
    # This file contains a list of all directories exported to other computers.
    # It is used by rpc.nfsd and rpc.mountd.
    
    /folder/to/export SERVER_A_IP(rw)
    

    Then, start nfs service and, from server A you may use:

    mount -t nfs SERVER_B_IP:/folder/to/export /mnt/mountpoint

    However, your question should have been posted on ServerFault. I flagged it as off topic, hope they move it.