Файловая система nfs windows

In business, the NFS (Network Filesystem Storage) protocol is mainly used to access the storage available on a NAS.
Moreover, this protocol is mainly used on Linux systems. However, you can also create an NFS server on Windows Server and easily create NFS shares.
For the NFS client, you’ll see this is available as a feature on client versions of Windows.

  1. Install NFS Server
  2. Create an NFS share
  3. Install NFS Client on Windows 10
  4. Access an NFS share from a client PC on Windows 10

To install an NFS server, simply run the «Add Roles and Features» wizard and select «Role-based or feature-based installation».

Select the server where you want to install it.

In the list of available roles, expand the «File and Storage Services» node and check the «Server for NFS» box found in : File and Storage Services -> File and iSCSI Services.

Click Install.

Wait while installing the NFS server.

The NFS server is installed.

2. Create an NFS share

To get started, create a folder wherever you want on your server.
For example, at the root of the «C» partition to avoid rights issues.

Create a test file inside this folder.

Open the Server Manager and go to the «File and Storage Services» section.

In the «Shares» tab, click on the «Tasks» button in the «Shares» section.

In the «New Share Wizard» window that appears, select «NFS Share — Quick» and click Next.

Select your NFS server (if needed), then select «Type a custom path» and click on : Browse.

Select the folder created previously, then click on : Select a folder.
In our case, it is the «C:\nfs-share» folder.

Once the path of the folder to be shared via NFS has been selected, click Next.

By default, the name of the share will correspond to the name of the folder selected previously.
Change this name if desired, then click Next.

  • Local path to share : local path to access this folder on your NFS server.
  • Remote path to share : network path to specify on the NFS client of a computer or server on your local network.

Since version 4.1 of NFS, you have the option of enabling Kerberos v5 authentication.
However, in this case, we will not use authentication to simplify this tutorial.

To do this, select the options :

  • No server authentication (AUTH_SYS)
  • Enable unmapped user access
  • Allow unmapped user access by UID/GID

By default, no one can access an NFS share from the network.
To authorize specific computers, servers or users to access your share, you must click on : Add.

In our case, we authorize our client PC to read and write to this NFS share by specifying :

  • Host: 10.0.0.12 (client PC IP address).
  • Share permissions : Read / Write.

Once the desired permission has been added, click Next.

If desired, you can configure additional permissions on this NFS share.
However, in our case, we didn’t change anything.

A summary of your NFS share configuration appears.

Click Create.

Once the NFS share has been created and the permissions set on it, click Close.

The created NFS share appears in the «Shares» list.

Network File System (NFS) клиент по умолчанию не установлен в Windows Server 2022/2019/2016 и десяточных версиях Windows 11/10. Для его установки запустите Server Manager, выберите Add Roles and Features -> Client for NFS.

Установка NFS клиента Windows Server 2019

Если вы хотите установить графические консоли управления NFS (nfsmgmt.msc), выберите дополнительно Services for Network File System Management Tools в Remote Server Administration Tools -> Role Administration Tools -> File Services Tools.

Services for Network File System Management Tools - консоль NFS

Или вы можете установить клиент NFS и консоль управления с помощью PowerShell:

Install-WindowsFeature NFS-Client, RSAT-NFS-Admin

В Windows 10/11 для установки NFS клиента выполните:

Enable-WindowsOptionalFeature -FeatureName ServicesForNFS-ClientOnly, ClientForNFS-Infrastructure -Online -NoRestart

Клиент NFS в Windows поддерживает NFSv2 и NFSv3.

Теперь вы можете подключить NFS шару с помощью PowerShell:

New-PSdrive -PSProvider FileSystem -Name M -Root \\192.168.0.211\mnt\hyperv -Persist

Опция Persist включает автоматическое подключение NFS шары после перезагрузки.

Из CMD:

mount -o anon nolock \\192.168.0.211\mnt\hyperv M:

Также вы можете смонтировать NFS каталог из графического интерфейса File Explorer.

Для отключения NFS шары, выполните:

Umount M:

Или

Remove-PSdrive -Name M

При подключении NFS шары может появится ошибка:

The remote device or resource won’t accept the connection.

Ошибка подключения NFS шары: The remote device or resource won’t accept the connection.

Чтобы исправить проблему, запустите консоль Services for Network File System (NFS) и проверьте права для подключения к удаленному ресурсу.

Если вы хотите подключиться к NFS ресурсу под anonymouse пользователем, нужно добавить два параметра реестра:

New-ItemProperty HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default -Name AnonymousUID -Value 000001f4 -PropertyType "DWord"
New-ItemProperty HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default -Name AnonymousGID -Value 00000064 -PropertyType "DWord"

Если для подключения нужно всегда использовать учетную запись root, измените значения параметров AnonymousUID и AnonymousGID на 0.

Если вы используете NFS подключения в окружении Active Directory, нужно отменить важный нюанс.

Если в AD не добавлены UNIX атрибуты и User Name Mapping не настроен, то для подключения к NFS серверу из Windows будет использоваться анонимное подключение. Для использование учетных данных для подключения к NFS вам нужно внести изменения в схему AD (атрибуты uidNumber и gidNumber).

На контроллерах домена WS 2012R2 можно добавить вкладку UNIX атрибутов в свойствах пользователя AD:

Dism.exe /online /enable-feature /featurename:adminui /all

Однако эта опция является deprecated в Windows Server 2016 и атрибуты пользователя предлагается править вручную или с помощью PowerShell:

Set-ADUser -identity user1 -add @{uidNumber="<user_unix_uid>";gidNumber="<user_unix_gid>"}

При подключении NFS каталога также может появится ошибка:

You can't access this shared folder because your organization's security policies block unauthenticated guest access. These policies help protect your PC from unsafe or malicious devices on the network.

В этом случае нужно создать параметр реестра AllowInsecureGuestAuth:
New-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters -Name AllowInsecureGuestAuth -Value 00000001
New-ItemProperty HKLM:\ oftware\Policies\Microsoft\Windows\LanmanWorkstation -Name AllowInsecureGuestAuth -Value 00000001

Затем перепустите службу NFS.

In this post I will explain how you can configure an NFS Server on a Windows 2016 Server and connect/mount the NFS exports on Linux clients, in my case I wanted to run a Linux virtual machine whist ensuring that the actual data resides on physical disks on my host machine ensuring that the data is automatically part of my nightly backup routine and did not need to run separate backup scripts on the VM(s).

A bit of background first…

In my home network I have a single (in an attempt to be eco-friendly) Intel i7 server running Windows Server 2016 Standard edition, I use this server for hosting my family media,  files and various database engines and ActiveDirectory for local development (I’m a software engineer by trade!) in addition to several Hyper-V virtual machines that do various tasks, all of the virtual machines are running a derivative of Linux.

I currently have the following virtual machines setup and running on it (under Hyper-V):

  • A Web Server and reverse proxy running Ubuntu Server 16.04 LTS – Hosting Gogs, Minio and various Nginx reverse proxy configurations for sites, services and API’s that sit on other VM’s in my network.
  • An OpenVPN server running CentOS 7 – Providing secure VPN tunnel access for me when  away from home.
  • A Jenkins server running Ubuntu Server 16.04 LTS– Used for automated code testing and continuous integration.
  • A MineCraft server running Ubuntu Server 16.04 LTS – Used by my daughter and friend to play online together.

In the past I used to run VMWare ESXi and hosted everything in their own virtual machine for better isolation and performance although since then, I had tested and was extremely happy with the performance of running virtual machines on top of Hyper-V and Windows Server so when I re-built my home server several months ago I decided to go down that route instead.

Anyway, enough of all that, let me explain why I have such a need for this kind of set-up…

My home server has 1x SDD (500GB for the host operating system and local applications) in addition to 2x WD Red 4TB hard drives in a hardware RAID1 configuration, I periodically backup this array over my LAN to a Buffalo NAS device.

My plan is to install a new VM running Ubuntu Server 16.04 that will host an instance of NextCloud, this will provide me, my family and friends with a free alternative to DropBox with masses of space in addition to all the other cool things that NextCloud offer such as encrypted video calls and the like.

By setting up an NFS server on the host operating system, instead of provisioning this Linux VM with a massive virtual hard disk (and taking drive space away from the host OS) I have instead provisioned it with a single 20GB virtual hard drive and will then use NFS shares on my Windows Server to host the files on the physical disk and thus be automatically part of my backup routine and alleviate the need for using rsync or rsnapshot etc. on the VM and transferring it at regular intervals.

Installing NFS Server on Windows Server 2016

First up, we need to login to our Windows Server and open up the Server Management tool, once open, click on the large text link labelled “Add Roles and Features” as shown here:

Once you have clicked on the “Add Roles and Features” link you should then be presented with this wizard:

Accept the default “Role-based or feature based installation” and then click Next

On the next screen you’ll be asked to choose the server that you want to add the role or feature to, select your server from the list that appears (you’ll probably only have one in the list anyway!) and then click Next

You will now be presented with a screen titled “Select server roles“, expand the following sections, then check the “Server for NFS” option as shown in the screenshot below:

Once checked, click on the “Next” button…

The next screen will just ask you to “Select features“, you can simply click “Next“!

Finally, you’ll be shown a screen asking you to confirm the installation items, we now choose “Install“, this screen and the selection of features and roles to add should look as follows:

Great! We now have an NFS server running on our Windows 2016 Server!

Creating an NFS share (export)

Now that we have the NFS server installed we can now go and share (or “export” as NFS likes to call it) a directory, as per my intro notes to this blog post, I plan to add this to my data RAID array.

So first up, lets go and create a new directory on our data disk (in my case this is my D: drive), I’ve decided to call the directory “NFS” and then, inside that folder we’ll create another directory called “VSVR-WEB040_data” – This folder will be explicitly shared with my VM (that is named ‘VSVR-WEB040‘, the “_data” portion I’ve just named as that is what I will mount the share locally on the VM as eg. /data).

Now that you have an NFS server installed you can share/export numerous directories to individual or multiple VM’s or even other physical servers in your network.

The result of setting up this directory structure is as follows:-

Next up, we’ll right-click on the newly created folder and choose Properties” – This will enable us to “Share” it as well as lock down the access to only a specific IP address (that being my NextCloud VM)…

From the Properties window, select the “NFS Sharing” tab and then click on the button named “Manage NFS Sharing” this should then display the following window:

Ensure that the above screenshot matches your folder (eg. select all the checkboxes as per the above)

Next we’ll configure the permissions for the share, clicking on the “Permissions” button in the above screenshot will then display the following window:

As you can see from the above screenshot, the permissions for this share are very restrictive by default, this is basically saying that for ALL MACHINES trying to access this share they WILL NOT be granted any access.

We should leave the defaults as is as we will instead create another permission only granting our specific VM access, to do this click on the “Add” button, the following screen should then appear:

I’ve entered my virtual server IP address in to the “Add names” field already (172.25.87.40), you’ll then need to change the “Type of access” drop-down box to “Read/Write” and check the “Allow root access” checkbox.

Once completed, click the “OK” button!

That’s great, our Permissions form should now look as follows:-

Perfect! – We’re all done on the NFS server side configuration now!

Mounting the NFS share on the client-side

We can now mount the NFS share on our Ubuntu Server (the virtual machine), first we need to install the NFS tools, so we’ll login to our server (I’m using root but you should really use a user with sudo rights!)…

sudo apt-get install -y nfs-common

So before we configure fstab to automatically mount our NFS share at system boot, we’ll first test using the command line to make sure everything works as expected…

Before we can mount the NFS share we must first create a mount point, we will do this like so:

sudo mkdir /data

Now that we have created the mount point, we can mount the remote file-system as follows:

sudo mount -t nfs 172.25.87.20:/VSVR-WEB040_data /data

Once mounted you should be able to run the following commands, these commands will essentially create a file on our server and a text file with some content…

echo "This is a test file" > /data/test.txt

We can now jump back over to our Windows server and check our NFS server directory, we should see a file named test.txt and when we open it in Notepad, the contents should appear as follows:-

All going well, that has hopefully worked a charm for you and we can now move on to ensuring that our VM automatically mounts the NFS share at boot.

If for whatever reason wish to un-mount the share you can do it like so:

umount /data

Configuring fstab to mount our NFS share on system boot

Using a text editor on the Linux VM we will open up the /etc/fstab file and add the following line to the bottom of the file:

172.25.87.20:/VSVR-WEB040_data /data nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0

You’ll obviously need to replace your server’s IP address with your own 😉

The result should look something like the below:

Once completed, save the file and you can now either attempt to automatically mount the share using this command:

sudo mount -a

…or you can reboot your server!

Once rebooted, login and you can then check and confirm that you have re-mounted your /data directory to the remote server by checking the output of:

df -h

You should be able to see and confirm the remote disk usage as demonstrated here:

OK, well that’s it, I hope this has been useful for you 🙂


Posted by
on September 22, 2016

Here we’re going to show you how to mount an NFS file share in Windows Server 2016 both temporarily and persistently so that it will automatically mount after a reboot.

There are a couple of different ways this can be done, including mapping a network drive or adding a network location, which we’ll discuss here.

Our NFS Server: In this example we already have an NFS server setup on a CentOS 7 Linux system which is available at 192.168.1.14 and we have exported the /root/nfs directory with NFS. See our guide on creating an NFS server in Linux here if you need information on how to do this.

Install NFS Client

Before we can mount any NFS shares on our Windows server, we must first install the NFS client feature. This can be done through the graphical user interface (GUI) using server manager, however that takes a lot longer so we’ll use some PowerShell.

First we’ll use the Get-WindowsFeature cmdlet to search for available features that contain the string ‘NFS*’ in the Name field.

PS C:\> Get-WindowsFeature -Name NFS*

Get-WindowsFeature Find NFS-Client Windows Server 2016

As we can see NFS-Client is available for install but not currently installed.

Next we use the Install-WindowsFeature cmdlet to install the NFS-Client feature, as shown below.

PS C:\>  Install-WindowsFeature -Name NFS-Client

Install-WindowsFeature NFS-Client Windows Server 2016

Once complete we should see that the installation has completed successfully, no reboot is required for this feature, we can begin using it straight away.

Mount NFS Temporarily

We can use the mount command in command prompt to quickly mount our NFS share and confirm that it’s working. Note that the mount command used here is in command prompt rather than PowerShell, using it in PowerShell will fail as it is a different command.

C:\Users\Administrators> mount \\192.168.1.14\root\nfs X:
X: is now successfully connected to \\192.168.1.14\root\nfs

The command completed successfully.

Command Prompt Mount NFS Windows Server 2016

At this point we can browse to “This PC” and we should see the NFS share mounted under Network Locations.

There is an issue with this however, this mount is not persistent meaning that if we perform a restart of the Windows server it will not be there afterwards. Luckily there are a few ways we can permanently map to the NFS file share.

Mount NFS Persistently

Most of the time we will want our NFS mount to survive a system reboot and mount automatically after boot so that we don’t have to manually mount it every time.

There are a couple of different ways that we can achieve this task:

  • Map Network Drive
  • Add A Network Location

Map Network Drive

I personally prefer this method, as we can see the space remaining much more easily.

  1. First open up “This PC” and select Computer from the menu at the top. From here click on Map network drive, as shown below.

    Map network drive

  2. The Map Network Drive window will open, select the drive letter that you want to assign to the NFS share, followed by the IP address or hostname of the NFS server as well as the path to the exported NFS directory. Click the Finish button when complete.

    Map network drive

    You may see a pop up window showing that the connection is being attempted. Once complete the shared NFS folder will open up.

  3. When you view “This PC” you will see the mapped network drive under Network location. This method is better than adding the network location as we’ll discuss next as it clearly shows how much disk space on the NFS share is in use and how much is still available.

    Map network drive

Add A Network Location

This will basically create a shortcut to the mounted NFS directory for you to access at any time, it will also be available after restart just like the map network drive method above.

  1. First open up “This PC” and right click in the white space area and select “Add a network location”.

    Add network location

  2. On the welcome screen click Next to proceed.

    Add network location

  3. Select that you want to choose a custom network location, followed by the Next button.

    Add network location

  4. Enter in two back slashes, followed by the IP address or hostname of your NFS server, followed by the path that is being exported by the NFS server. Click Next once you’ve filled this in.

    Add network location

  5. You can now select a custom name for the network location, click Next once you’ve set one.

    Add network location

  6. To complete the process, simply click the Finish button on the completion screen.

    Add network location

  7. We can optionally open the NFS mount now, or we can browse to “This PC” and see the folder shortcut listed under the “Network locations” setting as shown below.

    Add network location

    As mentioned note that this does not show the disk space in use like the network drive mapping option.

Summary

We have shown you how to install the NFS client feature in Windows Server 2016, and then mount an NFS share from a Linux server both temporarily through command prompt with the mount command, and persistently so that the NFS share is mounted automatically after the server has been restarted.

By doing this we can easily access files from a Unix or Linux based operating system over NFS from Windows.

Welcome to the world of NFS shares on Windows Server 2016. In this guide, we will explore the steps required to set up and configure NFS shares efficiently. Whether you’re a seasoned IT professional or a beginner, this guide will simplify the process for you.

Understanding NFS (Network File System)

NFS in a Nutshell

NFS, or Network File System, is a distributed file system protocol that allows you to share files and directories across a network. It’s widely used in UNIX-based systems and can be seamlessly integrated into Windows Server 2016.

Prerequisites

What You’ll Need

Before diving into NFS setup, ensure you have the following:

  • A Windows Server 2016 machine;
  • Administrative access to the server;
  • Network connectivity between the server and clients.

Installing NFS Server Role

Step 1: Server Manager

Begin by launching the Server Manager on your Windows Server 2016 machine.

Server Manager

Step 2: Add Roles and Features

Navigate to the “Manage” tab in Server Manager and select “Add Roles and Features.” Follow the wizard to install the NFS server role.

Add Roles and Features

Note: Ensure that you select the “File Server” role service and enable “Services for Network File System”.

Configuring NFS Share

Step 1: Open NFS Sharing

Head to the “Tools” menu in Server Manager and select “NFS Sharing.” Click on “Manage NFS Sharing” to begin the configuration.

Step 2: Create a New NFS Share

Click “Add a new Share.” You’ll be prompted to specify the path and share name. Be mindful of the share name as it will be used by clients to access the share.

Setting Permissions

Securing Your NFS Share

To ensure your NFS share is secure, you must configure permissions properly. Navigate to the “Permissions” tab in the NFS Sharing window and specify the appropriate permissions for users and groups.

Mounting NFS Share on Clients

Accessing NFS Share from Clients

Now that your NFS share is set up, you can mount it on client machines. Depending on the client’s operating system, the process may vary. However, the common steps involve using the mount command or configuring the NFS client.

Performance Tuning

Optimizing NFS for Better Performance

To make the most of your NFS share, you can fine-tune its performance. This can involve adjusting settings like block size, buffer size, and timeout values to match your network’s requirements.

Troubleshooting NFS Issues

Common Problems and Solutions

Encountered issues with your NFS share? We’ve got you covered. This section will address common problems and provide troubleshooting steps to resolve them.

Managing NFS Share Access

Once you’ve set up your NFS share, you’ll need to manage who can access it and what they can do with the shared files. Here’s how you can do that:

Access Control Lists (ACLs)

You can control access to your NFS share by using Access Control Lists (ACLs). ACLs allow you to specify permissions for specific users or groups with fine-grained control. Here’s a table illustrating some common ACL permissions:

Permission Description
Read Allows users to view and copy files
Write Permits users to create and modify files
Execute Grants permission to run executable files
Delete Allows users to delete files and directories

User Mapping

When working in mixed environments with both Windows and UNIX-based systems, it’s essential to map Windows user accounts to UNIX user accounts. This ensures that permissions are correctly applied when accessing the NFS share.

Here’s a quick list of steps to configure user mapping:

  • Install and configure Identity Mapping Services (IDMAP) on your Windows Server;
  • Map Windows users to UNIX users using the mapadmin command;
  • Verify mappings to ensure proper user access.

Backup and Disaster Recovery

Securing your NFS share data is paramount. Implementing a robust backup and disaster recovery plan is essential to ensure data availability and integrity.

Backup Strategies

Consider these backup strategies:

  1. Regular Backups: Schedule regular backups of your NFS share data to an external storage device or cloud service;
  2. Versioning: Implement versioning to track changes and recover previous file versions when needed;
  3. Off-site Backups: Store backups off-site to protect against on-site disasters.

Disaster Recovery

Prepare for unexpected disasters:

  1. Data Replication: Use techniques like data replication to maintain a secondary copy of your NFS share data;
  2. Redundancy: Implement redundant hardware configurations to minimize downtime;
  3. Testing: Regularly test your disaster recovery plan to ensure it works as expected.

NFS Security Best Practices

Ensuring the security of your NFS share is crucial to protect sensitive data and maintain system integrity. Follow these best practices:

Firewall Configuration

  • Use firewalls to restrict access to your NFS server to only trusted IP addresses;
  • Utilize network segmentation to isolate your NFS share from untrusted networks.

Encryption

  • Enable encryption for NFS traffic using protocols like NFSv4.1 or NFSv4.2;
  • Implement secure communication between clients and the server using tools like Kerberos.

Regular Updates

  • Keep your Windows Server 2016 and NFS server software up to date to patch security vulnerabilities.

Monitoring and Auditing

  • Implement monitoring and auditing tools to track NFS share access and detect potential security breaches.

NFS vs SMB: A Comparison

In the world of file sharing on Windows Server, you have multiple options, including NFS and SMB (Server Message Block). Let’s compare these two protocols:

Feature NFS SMB
Supported Platforms UNIX, Linux, Windows, macOS Windows, Linux, macOS
Authentication User-based (Kerberos) User-based (Active Directory)
Performance Generally faster for UNIX systems Optimized for Windows environments
Cross-Platform Support Excellent cross-platform support Primarily used in Windows environments
Security Requires additional configuration Built-in security features

Conclusion

Creating NFS shares on Windows Server 2016 can significantly enhance your network’s file sharing capabilities. By following the steps outlined in this guide, you’ll be well on your way to harnessing the full potential of NFS.

FAQs

What is NFS, and why should I use it on Windows Server 2016?

NFS is a network file system protocol that enables efficient file sharing across networks. Using it on Windows Server 2016 can enhance cross-platform compatibility and improve file sharing performance.

Can I set up multiple NFS shares on the same Windows Server 2016 machine?

Absolutely. You can create and manage multiple NFS shares on a single Windows Server 2016 machine to cater to different needs.

Are there any security concerns when using NFS on Windows Server 2016?

Security is crucial. Ensure you configure permissions correctly, limit access to trusted clients, and consider network-level security measures to protect your NFS shares.

What are some performance optimization techniques for NFS shares?

Performance can be improved by adjusting NFS settings, optimizing network infrastructure, and choosing appropriate hardware for your server.

Can NFS shares be accessed from non-Windows systems?

Yes, NFS shares can be accessed from various operating systems, including UNIX-based systems and Linux, making it a versatile choice for cross-platform file sharing.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • 1с7 7 windows 7
  • Bignox что это за папка в windows 10
  • Scx 4100 xev драйвер windows 7
  • Page file windows 2000
  • Aka ms windows sysreq