banner
Prajna

Prajna

github
twitter
email

How to use NFS mount in Ubuntu on WSL2

Installation [[nfs]]

sudo apt update
sudo apt install nfs-common

Next, you can directly mount it

# Create mount folder
sudo mkdir /mnt/nfs_share

# Test if it can be mounted
sudo mount -t nfs 192.168.2.208:/mnt/mnt2/media /mnt/nfs_share

It can also be mounted after restarting

vim /etc/fstab 
192.168.2.208:/mnt/mnt2/media /mnt/nfs_share nfs defaults 0 0

However, within [[wsl]], mounting will fail due to the nfs-server issue

protocol not supported

I found a related issue
Can't mount NFS from within WSL2 Ubuntu 22.04 · Issue #9790 · microsoft/WSL · GitHub
Mounting directly on a regular server works, and I confirmed that it is a server problem. I am using Truenas

Check the nfs service configuration

image

vim /etc/exports

Add insecure to the file directory

"/mnt/mnt2/media"\
	*(sec=sys,rw,insecure,no_subtree_check)

Now continue to use mount

sudo mount -t nfs 192.168.2.208:/mnt/mnt2/media /mnt/nfs_share

This article is synchronized and updated to xLog by Mix Space
The original link is https://www.prajnax.com/posts/default/wsl2_nfs


Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.