Creating NFS Shares

With the Network File System (NFS) protocol, you can create and manage NFS shares in an Oracle Cloud Infrastructure (OCI) instance, and export files to the compute instance.

Note

Supported NFS protocols include: NFSv3 and NFSv4

Prerequisites and Considerations

Before you begin:

Creating an NFS Share In an OCI Instance

To create an NFS share in an OCI instance from the command line:

  1. Do one of the following:
    • Follow the instructions in Managing the Network File System, with the following consideration:

      • Before you edit the etc/exports file, the directories and files that you want shared on the instance must already exist, and must have the appropriate permissions, as required by your environment.
    • Follow the tutorial at Create an NFS server on Oracle Linux.
  2. Access the NFS share. See Accessing NFS and Samba Shares.

Creating an NFS Share In an OCI Instance Using Cockpit

You can create an NFS share in a compute instance from the Cockpit web console by using the Cockpit file sharing plugin.

To create an NFS share using the Cockpit web console:
  1. On the compute instance, install and enable Cockpit. See Install and Enable Cockpit.
  2. Use DNF to install the cockpit-file-sharing package.

    The package is located in the DNF developer_EPEL repository, and you must enable the repository before installing the cockpit-file-sharing package.

    For example:

    sudo yum-config-manager --enable ol9_developer_EPEL
    sudo dnf install cockpit-file-sharing
    Note

    Packages found in the developer_EPEL repositories are considered unsupported and are only entitled to basic installation support. Content from this repository isn't recommended for production environments and is intended for developer purposes only.
  3. Log in to Cockpit. See Log in to the Cockpit Web Console.

  4. From the Cockpit web console, click Services, and search for the NFS server.

    If you find the NFS server, skip to Step 7. If NFS hasn't been configured, or the NFS service is off, go to the next step.

  5. To enable the NFS server and service, click the NFS server and services gray toggle.

    Clicking the toggle enables the NFS service to automatically start, and enables the service to start after each system reboot.

  6. From the Services page, navigate to the Sockets section, and click the RPCbind Server Activation Socket gray toggle.

    Clicking the toggle enables the RPC socket to automatically start, and enables the socket to start after each system reboot.

  7. Create a new NFS share:
    1. Click File Sharing, select the NFS tab, and then click the blue plus sign (+) button.

      The Add Export window is displayed.

    2. Enter the name and path of the NFS share, and in the Client Name and Client IP fields, enter the compute instance name and IP address.

    3. Click Add.

      Note

      The NFS share isn't visible in the /etc/export path. Instead, the exportfs command creates the NFS share at run time, and the NFS share resides in the /var/lib/nfs/etab path. To inspect the NFS share, use the exportfs -s command.
  8. Access the NFS share. See Accessing NFS and Samba Shares.