Skip to main content

Mount an NFS share.

First, create an NFS Share on your host

With OMV for example.

The location of the files to share. The share will be accessible at /export/. Clients allowed to mount the file system, e.g. 192.168.178.0/24. Please check the [manual page](https://manpages.debian.org/nfs-kernel-server/exports.5.html) for more details.
`192.168.1.0/24`

`Read/Write`

`subtree_check,insecure`
Please check the [manual page](https://manpages.debian.org/nfs-kernel-server/exports.5.html) for more details.

## Installing NFS Client Packages

To mount an NFS share on a Linux system first you’ll need to install the NFS client package. The package name differs between Linux distributions.

Installing NFS client on Ubuntu and Debian:

sudo apt update
sudo apt install nfs-common

Manually Mounting an NFS File Systems

Mounting a remote NFS share is the same as mounting regular file systems.

To mount an NFS file system on a given mount point, use the mount command in the following form:

```bash mount [OPTION...] NFS_SERVER:EXPORTED_DIRECTORY MOUNT_POINT ```

Use the steps below to manually mount a remote NFS share on your Linux system:

  • First, create a directory to serve as the mount point for the remote NFS share:

    sudo mkdir /mnt/OrbiterVideo
    

Mount point is a directory on the local machine where the NFS share is to be mounted.

  • Mount the NFS share by running the following command as root or user with sudo privileges:

    sudo mount -t nfs orbiter:/Video /mnt/OrbiterVideo
    

Where orbiter is the LAN Name of the NFS server, /Video is the directory that the server is exporting and /mnt/OrbiterVideo is the local mount point.
Can be with IP adress

 

``` sudo mount -t nfs 10.10.0.10:/Video /mnt/OrbiterVideo ```

Automatically Mounting NFS File Systems with /etc/fstab

nano /etc/fstab

Add line

orbiter:/Video /mnt/OrbiterVideo  nfs      defaults    0       0

Unmounting NFS File Systems

The umount command detaches (unmounts) the mounted file system from the directory tree.

To detach a mounted NFS share, use the umount command followed by either the directory where it has been mounted or remote share:

umount orbiter:/Video
#or
umount /mnt/OrbiterVideo

Permission problems ?

sudo chown -R root:root path/to/Video
sudo chmod -R 755 path/to/Video
Extensive explications from ChatGPT

To address this "Permission denied" error, let’s go through a few key steps to ensure your NFS share is correctly configured for root-level access between your two Debian machines.

Steps to Resolve "Permission Denied" Error:

1. Verify NFS Export Permissions on the Server Side On the NFS server (the machine hosting the /Video folder), make sure the directory is exported with the correct permissions in /etc/exports. Add or update the relevant line in /etc/exports to ensure the client machine has both read and write permissions and that root squashing is disabled.

/Video *(rw,no_root_squash,sync)
  • rw: Allows read and write access.
  • no_root_squash: Allows the root user on the client to maintain root privileges on the share.
  • sync: Ensures changes are committed to disk before reporting success. After updating /etc/exports, apply the changes by running:
sudo exportfs -ra

2. Restart the NFS Service Restart the NFS server to apply any configuration changes:

sudo systemctl restart nfs-kernel-server

3. Mount the NFS Share on the Client Side Ensure the client machine mounts the NFS share with the correct permissions. Since an entry was added in /etc/fstab, remount it with:

sudo mount -a

Alternatively, mount manually for testing:

sudo mount -t nfs orbiter:/Video /mnt/OrbiterVideo

4. Check Ownership and Permissions on the NFS Share On the NFS server, ensure that the /Video directory has permissions allowing the root user on the client to write to it.

sudo chown -R root:root /Video
sudo chmod -R 755 /Video # Adjust permissions as needed

5. Test File Creation After mounting, try creating a file in /mnt/OrbiterVideo on the client as the root user:

sudo touch /mnt/OrbiterVideo/testfile

Additional Troubleshooting Tips

  • If permission issues persist, re-check root_squash settings and permissions on the /Video directory.
  • Ensure both machines synchronize UID/GID settings if user-level permissions are required.