NFS (Network File System) — сетевой протокол доступа к доступ к файлам и файловой системе NFS-сервера, популярный в семейства ОС Linux/ UNIX, а также различных системах хранения. Microsoft также, не желая отставать от конкурентов, внедрила базовый функционал NFS сервера еще в Windows Server 2003 R2. В последующих версиях серверных платформ Microsoft возможности встроенного NFS Windows сервера расширялись, появлялся новый функционал и средства управления. NFS сервер в Windows Server 2012 – очередная веха в развитии данной технологии.
Что же нового предлагают нам разработчики Microsoft в данном продукте? Новые возможности NFS сервера в Windows Server 2012:
- Поддержка стандарта NFS v4.1. Поддержка последней версии NFS 4.1 – одно из основных новшеств Windows Server 2012. По сравнению с NFS v3 этот протокол обеспечивает повышенную безопасность, производительность и совместимость, полностью реализуя все аспекты RFC 5661.
- Производительность «из коробки». Благодаря использованию новой транспортной инфраструктуры RPC-XDR, оптимальная производительность NFS сервера может быть достигнута сразу «из коробки» без необходимости тонкой настройки параметров системы. Оптимальная производительность достигается за счет автоматически настраивающегося кэша, разделения рабочих процессов на пулы и динамическое управление пулами, основанное на их нагрузке.
- Упрощенное развертывание и управление. Данный факт достигнут за счет:
- — более 40 командлетов PowerShell для настройки сервера NFS и управления общими папками
- — простого графического интерфейса управления, позволяющего одновременно управлять как SMB, так и NFS шарами, а также настройками скрининга файлов и файловой классификации.
- — фиксации RPC порта (порт 2049) для простоты настройки файерволов
- — нового провайдера WMI v2
- — упрощенной идентификации за счет плоского файла мапинга
- Улучшения в NFSv3. За счет быстрой отправки клиентам уведомлений о сбоях монитором NSM (Network Status Monitor), старые NFS клиенты лучше и быстрее обрабатывают процедуру failover, что означает меньшее время простоя.
Итак, NFS сервер в Windows Server 2012 значительно улучшен с точки зрения простоты развертывания, масштабируемость, стабильность, доступность, надежность, безопасности и совместимости. Общие папки могут быть одновременно доступны по протоколам SMB и NFS, что означает возможность использования Windows Server 2012 в качестве хранилища в гетерогенных сетях.
Далее мы разберем сценарий развертывания и управления сервером NFS в Windows Server 2012.
Установка NFS сервера в Windows Server 2012
NFS сервер в Windows Server 2012 можно установить с помощью GUI и Powershell. Чтобы установить NFS сервер с помощью графического интерфейса, откройте консоль Server Manager и внутри роли файлового сервера (File and Storage Services) отметьте компонент Server for NFS.
После окончания установки компонента NFS, сервер необходимо перезагрузить.
Установка этой же роли с помощью Powershell также не вызывает затруднений, просто выполните команду:
Add-WindowsFeature "FS-NFS-Service"
Настройка общей папки NFS в Windows Server 2012
Далее мы покажем, как с помощью установленной нами роли создать NFS шару (общую папку) на сервере Windows. Создать NFS шару можно опять несколькими способами: с помощью графического интерфейса или Powershell.
Создание общего каталога NFS с помощью консоли Server Manager
Откройте консоль Server Manager, перейдите в раздел Share management (находится внутри роли File and Storage Services).
В контекстном меню запустите мастер создания нового общего каталога- New Share…
Выберите тип шары NFS Share — Quick
Далее нужно указать местоположение каталога на диске и путь, по которому должны подключатся удаленные NFS клиенты.
Затем необходимо задать тип аутентификации NFS клиентов: возможно, задействовать как Kerberos- аутентификацию, так и анонимную.
Предположим, в качестве потребителя создаваемого NFS ресурса будет выступать сервер виртуализации ESXi, в котором возможность аутентифицировать NFS соединения отсутствует (ESXi не поддерживает NFSv4). Поэтому тип аутентификации будет No Server Authentication, отметим также опции Enable unmapped user access и Allow unmapped user access by UID/GID.
Чтобы немного обезопасить создаваемую NFS шару от доступа сторонних лиц, ограничим доступ к NFS ресурсу по IP адресу клиента.
Host: 192.168.1.100
Language Encoding : BIG5
Share Permissions : Read/Write
Allow root access : Yes
Далее осталось проверить, что на уровне NTFS пользователь, в которого мапится подключающийся юзер, имеет доступ на чтение/запись (если решено задействовать анонимный доступ, придется для пользователя Everyone дать полные r/w права на уровне NTFS).
Как создать NFS шару с помощью Powershell
Создадим новую NFS шару:
New-NfsShare -Name "NFS " -Path "d:\shares\nfr" -AllowRootAccess $true -Permission Readwrite -Authentication sys
Разрешим доступ к шаре для IP адреса 192.168.1.100 и зададим кодировку BIG5 (возможность просмотра содержимого NFS шары для клиента ESXi).
Grant-NfsSharePermission -Name “NFS” -ClientName 192.168.1.100 -ClientType host -LanguageEncoding BIG5
Созданную NFS шару можно использовать, например, как NFS-datastore в среде виртуализации VMWare vSphere, или для доступа к данным с других Unix-like клиентов. Как смонтировать NFS шару в Windows — клиентах описано в этой статье.
Overview
Microsoft’s Windows Server has had the ability to host NFS shares since Server 2003. There are a number of reasons why you may need it, such as backing up SharePoint or sharing files with UnixLinux computers, and for the most part it works fairly well.
This tutorial will guide you through installing and configuring it. Although not covered in this tutorial, Active Directory mappings can be created for your Linux users accounts to grant them access to directories and files using NTFS shares.
Hardware Configuration
The sizing of your server will greatly depend on the type and volume of traffic. There absolutely is no one-size-fits-all configuration. Your success will be determined by how well you know the workload profile that the server will experience.
TABLE1 – File server hardware considerations
Lots of Large File Tranfsers | If your server primarly serves large files and many of them are transfered concurrently, you’re going to want a lot of RAM in the server. The RAM will be used as a cache before the data is transmitted. |
---|---|
Lots of Tiny File Transfers | If instead you are transfering a lot of tiny files, you will want the storage be on fast disks. Transfing large amounts of tiny files can create an enormous amount of I/O, which may require a RAID group with lots of disk, an SSD drive, or Flash drive. |
High Concurrency and File Transfers | Large amounts of memory and CPU may be required to handle the load. |
ODX Supported Backend Storage | If you have multiple shares hosted on ODX supported storage served by your file server, and your users do a lot of copies between shares, ODX will significantly improve performance. It does this by offloading the data movement to the storage controller. It also means your file server frees more resources for other connections. |
These are just examples. Your mileage will vary depending on a lot factors in your environment. The best advice I can give is to monitor your server once it is in production. Keep an eye on disk queue times, latency, CPU, and memory utilization.
Install NFS File Services
- Launch Server Manager.
- On the top menu, click Manage.
- Click Add Roles and Features.
- On the Before you begin screen, click Next.
- On the Select installation type screen, ensure Role-based or feature-based installation is selected, and then click Next.
- On the Server selection screen, click Next.
- On the Select server roles screen, expand File and Storage Services, expand File and iSCSI Services, and then check Server for NFS.
- Click Next.
- If an Add features that are required for Server NFS dialog box appears, click Add Features.
- On the Select feature screen, click Next.
- Confirm the installation details, and then click Install.
Configure an NFS Share
- Launch File Explorer.
- Create a new directory for your NFS share.
- Right-click the directory and click Properties.
- Select the NFS Sharing tab.
- Under the NFS Sharing tab, click the Manage NFS Sharing… button
- Check the Share this folder check box.
- Enter a name into the Share name text field. This will be used when a user connects to your NFS share.
- Click the Permissions button.
- Click Add and then enter the IP address or hostname of the client(s) you want to allow connections to. When added, you may also select whether they have readwrite access or read-only access.
- Click OK.
- Click Apply and then OK.
- You now have a simple NFS share hosted on a Windows Server 2012 R2 box.
Connect a Linux Client to the NFS Share
- Log onto a Linux server or desktop.
- Open a terminal window, if you are in a Desktop version of the operating system.
- Create a new directory to mount the Windows NFS share.
mkdir /postprod
- Mount the NFS share to the new directory.
mount.nfs slfileserver01:/postprod /postprod
- If the client has readwrite access, test the share by creating a new file.
touch file01.txt
How-To
How To Set Up an NFS Server on Windows Server 2012
In five minutes, you could have one, too.
While working on an article about using vRealize Log Insight’s (vRLI) built-in archiving utility, I needed an NFS server to act as its archive repository. I have a Windows Server 2012 in my lab and decided to use it as the NFS repository. Although the process of setting the NFS server is relatively easy, I found it to be unintuitive. In this article I’ll walk you through the process of setting up the NFS server and then mounting it with a Linux system, using it as a vRLI repository, and eventually using it as a datastore on an ESXi host.
Setting up the Server
As the base operating system for the NFS server, I used a virtual machine with 2 vCPUs with 16GB of RAM running on a ESXi 6.5 host running Windows Server 2012 R2 Essentials.
After logging into my Windows Server 2012 as Administrator, I launched Windows Server Manager by typing «ServerManager.exe» in the «run command» window. I then clicked the Manage tab and clicked Add Roles and Features (Figure 1).
Figure 1.Adding Roles and Features within Windows Server Manager in Windows Server 2012.
Once in the Roles and Features Wizard, I clicked Next, selected Role-based or feature-based installation, clicked Next, clicked Next again, expanded the File and Storage Services, expanded File and iSCSI Services, checked the Server for NFS checkbox, and clicked Next. When the «Add features that are required for Server for NFS?» dialog box appeared (Figure 2), I clicked Add Features, then Next, and lastly Install. It took about one minute for the NFS feature to finish installing, including a required reboot.
Figure 2. Adding file service tools.
After Windows Server 2012 restarted, I logged back in and added an NFS share. First I created a new folder on my desktop called «NFS01,» right-clicked the NFS01 folder, clicked Properties, selected the NFS Sharing tab, clicked the Manage NFS Sharing button, checked the Share this folder check box, clicked the Permissions button, checked Allow root access, clicked OK, then Apply, and finally OK (see Figure 3).
Figure 3. Creating an NFS share.
Connecting a Linux System
After I set up the NFS server, I initially tested it by connecting to it from a Linux system (Ubuntu 14.04) by doing the following:
I first became the root user, then created a mount point, mounted the NFS filesystem on the mount point, listed the NFS filesystem, created a new file, listed the file, changed back to my home directory, unmounted the NFS filesystem, listed the file directory (which was now empty), remounted the NFS filesystem and listed the file again.
I completed these steps using the commands shown in Figure 4. If you want to have the NFS filesystem mounted every time that you boot the server, you can put an entry in the /etc/fstab file on the Linux server.
Figure 4. Mounting NFS in Linux.
vRealize Log Insight Repository
After I verified that I could access the NFS share from a Linux system, I configured vRealize Log Insight (vRLI) to use NFS as its archive repository. I started by logging into my vRLI instance as Admin from the vRLI interface, then went to the Administration page, selected Archiving, clicked Enable Data Archiving, entered nfs://10.0.0.60/NFS01 in the Archive Location text box, clicked Test and received a «Test successful» message (Figure 5 ).
Figure 5. Setting up an archive location for vRealize Log Insight.
Connecting an ESXi Host
Since I had an NFS share mounted, I decided to try and attach it to an ESXi server. (
As a disclaimer, VMware does not endorse, recommend or support using Windows 2012 NFS as a datastore on ESXi, and it’s not on their Hardware Compatibility List (HCL). The instructions here are to show that it can be done, not that it should be done.
)
I mounted the NFS filesystem on my ESXi 6.5 host from a vCenter 6.5 Web Client without any problems by opening the vSphere Web Client, from where I selected Storage, right-clicked My Datacenter, then selected Storage > New Datastore.
Figure 6.Adding the Windows NFS share to ESXi.
From the New Datastore Wizard, I clicked Next, selected NFS, clicked Next, selected NFS 4.1, clicked Next, supplied the name of the NFS filesystem and the IP address of the NFS server, clicked Next, clicked Next again, selected the ESXi hosts that would have access to the NFS filesystem, clicked Next, and clicked Finished (the steps are shown in 6). The NFS share then appeared in my vSphere Web Client (Figure 7).
Figure 7. The Windows NFS share, displayed on the ESXi server.
In total, it took me less than 5 minutes to create an NFS server on my Windows 2012 R2 Essentials server. I could mount its NFS share to a Linux system and use it as an archive repository for vRealize Log Insight (vLRI). I was even able to mount it to my ESXi host without any issues, although VMware does not officially support using it as a datastore.
About the Author
Tom Fenton has a wealth of hands-on IT experience gained over the past 30 years in a variety of technologies, with the past 20 years focusing on virtualization and storage. He previously worked as a Technical Marketing Manager for ControlUp. He also previously worked at VMware in Staff and Senior level positions. He has also worked as a Senior Validation Engineer with The Taneja Group, where he headed the Validation Service Lab and was instrumental in starting up its vSphere Virtual Volumes practice. He’s on X @vDoppler.
I’ve written previously about configuring a Windows 2008 NFS server. Whilst looking at the NFS related objectives for the VCAP5-DCA exam recently, I needed a NFS server for use in my lab, so it was as good a time as any to create a Windows 2012 R2 server for NFS.
As with Windows 2008, the installation of NFS services on Windows 2012 R2 is straight forward. I decided to use Powershell to carry out the installation. The cmdlet to use is the ‘Add-WindowsFeature’ cmdlet:
Add-WindowsFeature FS-NFS-Service
This will install the NFS services, the you can use the following cmdlet to install the management tools:
Add-WindowsFeature RSAT-NFS-Admin
Once the installation is complete, you can create NFS shares using server manager:
Alternatively you can use Powershell to create shares:
Import-Module NFS
New-NfsShare -name nfsshare1 -Path C:\shares\nfs1
Apr 3, 2016
Introduction
Let’s face it, we support mixed environments and sometimes we need to access information on Linux systems on our Windows systems. With that said say you have a Windows server that needs to get to NFS exports on a Linux systems. Well that is completely doable on Windows Server 2012 R2 using Client for NFS. Note: You can also mount NFS if you are running Windows 7 Enterprise or Ultimate versions.
Using Client for NFS
First we will need to install the Client for NFS feature on our systems needing to access the FS exports. Using Server Manager click on Manage > Add Roles and Features. Click Next until you reach the features selection and then select Client for NFS. Click Next then install. Now the client is installed. There are a few new commands installed with the client that we will cover in this post.
nfsadmin.exe
nfsclnt.exe
mount.exe
umount.exe
showmount.exe
To start Client for NFS from the Windows interface
After installation this service should start by default, if not. Open Services for Network File System: click Start, point to Programs or All Programs, point to Administrative Tools, and then click Services.
Right-click Client for NFS, and then click Start Service.
To start Client for NFS from the command line
Open an elevated privilege command prompt.
At the command prompt, type:
nfsadmin client [ComputerName] start
Mounting and NFS Share
To mount an NFS shared resource to a drive letter using the command line
Open a command prompt (this does not need to be an elevated command prompt).
At the command prompt, type the following:
mount [-o options] [-u:username] [-p:<password | *>] <\\computername\sharename> <devicename | *>
Here are a few of the options when mounting and NFS share on Windows.
Option | Description |
-0 rsize= n | The read buffer size, in kilobytes. Acceptable values are 1, 2, 4, 8, 16, and 32. The default is 32 KB. |
-o wsize= n | The write buffer size, in kilobytes. Acceptable values are 1, 2, 4, 8, 16, and 32. The default is 32 KB. |
-o timeout= n | The time-out for a remote procedure call (RPC), in seconds. Acceptable values are 0.8, 0.9, and any integer in the range 1-60. The default is 0.8. |
-o retry= n | The number of retries for a soft mount. Acceptable values are integers in the range 1-10. The default is 1. |
–o mtype={soft | hard} | Soft or hard mount. Regardless of the mount type, the mount will return if it cannot immediately mount the shared resource. However, once the shared resource has been successfully mounted, if the mount type is a hard mount and the Network File System (NFS) server becomes unavailable, Client for NFS will retry accessing the shared resource until the NFS server is once again available. As a result, Windows applications that are trying to access the shared resource will appear to stop responding. |
-0 anon | Mounts as anonymous user. |
-o nolock | Disables locking. This option might improve performance if you only need to read files. |
-o lang= n | To specify the encoding used for file and directory names. euc-jp|euc-tw|euc-kr|shift-jis|big5|ksc5601|gb2312-80|ansi |
-o fileaccess= mode | Specifies the default permission mode of new files that are created on the NFS shared resource. The permission mode is written as a three-digit number in the form ogw, where o, g, and w represent the access granted to the file (o)wner, (g)roup, and the (w)orld. Each digit must be in the range 0–7, with the values corresponding to the following access levels:
|
-o casesensitive | Forces case-sensitive file lookup (similar to that of UNIX-based NFS clients). |
-o sec= sys | |krb5|krb5i|krb5p (Kerberos Security) |
ComputerName | The name of the server with the shared resource to mount.The name of the shared directory to mount. |
ShareName | The name of the shared directory to mount. |
DeviceName | * | The drive letter to assign to the mounted shared resource. The asterisk (*) means to use the next available letter. |
Notes:
To view the complete syntax for this command, at a command prompt, type: mount /?
When mounting an NFS shared resource to a drive letter, we recommend the format ComputerName:/ ShareName.
You can also use the net use command to mount an NFS shared resource to a drive letter.
Examples:
To mount and NFS Export to drive no user credentials G:
mount \\192.168.1.110\export G:
Mount an NFS export in read write mode with username and password
mount -o fileaccess= 7 -u: homey -p: homestead 192.168.1.110/export g:
To view NFS exports on a server
showmount -e 192.168.1.110
To unmount an NFS shared resource from a drive letter using the command line
Open a command prompt (this does not need to be an elevated command prompt).
At the command prompt, type:
umount [–f] {–a | Drive}
umount options:
-f = Force unmount
-a = Unmount all NFS drives
umount -f G:
Conclusion
As you can see, we can now access NFS exports from our Windows Server 2012 R2 systems using the Client for NFS feature. At this point we can start exploring PowerShell NFS cmdlets and their usage https://technet.microsoft.com/en-us/library/jj603081(v=wps.630).aspx.