Difference between revisions of "NFS"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
Line 41: Line 41:
 
* <code>New-PSDrive -Name K -PSProvider FileSystem -Root "\\ServerName\ShareName" -Persist -Scope Global</code><ref>https://community.spiceworks.com/topic/2219152-powershell-mapping-network-drive</ref>
 
* <code>New-PSDrive -Name K -PSProvider FileSystem -Root "\\ServerName\ShareName" -Persist -Scope Global</code><ref>https://community.spiceworks.com/topic/2219152-powershell-mapping-network-drive</ref>
 
* <code>New-PSDrive -Name K -PSProvider FileSystem -Root "\\ServerName\ShareName" -Persist -Credential $cre -Scope Global</code>
 
* <code>New-PSDrive -Name K -PSProvider FileSystem -Root "\\ServerName\ShareName" -Persist -Credential $cre -Scope Global</code>
 +
 +
See also: https://davidring.ie/2018/07/06/windows-2016-mount-an-nfs-share/
  
 
== Configuration files ==
 
== Configuration files ==

Revision as of 12:53, 6 April 2020

Network File System (NFS) is a distributed file system protocol that allow to share files and folders using a TCP network.

Installation

apt install nfs-common
apt install nfs-kernel-server
 systemctl status nfs-server.service

Linux commands

  • exportfs (apt install nfs-kernel-server)

Example output NFS share to everyone: HOST#exportfs /nfs <world>


showmount
Hosts on SERVER_NAME:
showmount -e
Export list for SERVER_NAME:


showmount -e
Export list for SERVER_NAME:
/path/exported 10.10.10.10/24
showmount
clnt_create: RPC: Program not registered
showmount -e
Restart service: systemctl start nfs-server

Windows commands

  • Get-WindowsFeature -Name NFS*
  • Install-WindowsFeature -Name NFS-Client
  • mount 192.168.0.1:/FOLDER_NAME n:
  • New-PSDrive -Name Z -PSProvider FileSystem -Root "\\192.168.0.251\FOLDER_NAME"[1]
    • Remove-PSDrive Z
  • New-PSDrive -Name K -PSProvider FileSystem -Root "\\ServerName\ShareName" -Persist -Scope Global[2]
  • New-PSDrive -Name K -PSProvider FileSystem -Root "\\ServerName\ShareName" -Persist -Credential $cre -Scope Global

See also: https://davidring.ie/2018/07/06/windows-2016-mount-an-nfs-share/

Configuration files

/etc/exports [3]

Example:

/export       192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async)
/export/users 192.168.1.0/24(rw,nohide,insecure,no_subtree_check,async)
fsid=0 signals the NFS server that this export is the root.

Warning: /etc/exports is affected by adding additional space characters, be mindful about format

NFSv4

NFSv4 no longer utilizes the MOUNT protocol.

Activities

Install server: apt-get install nfs-kernel-server
Install client (optional): apt-get install nfs-common
  • Mount a remote nfs share:
mount -t nfs -o proto=tcp,port=2049 REMOTE_IP_SERVER:/REMOTE_SHARE_DIR /YOUR/LOCAL_DIR/
mount -t nfs4 10.10.10.2:/ ./
mount: /mnt: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program
(Install client:  apt-get install nfs-common)

See also

  • https://www.server-world.info/en/note?os=Windows_Server_2019&p=nfs&f=4
  • https://community.spiceworks.com/topic/2219152-powershell-mapping-network-drive
  • https://linux.die.net/man/5/exports
  • Advertising: