Configure NFS in Windows Server
On Windows Server, creating a new NFS server is simple.
First install this:
And then click the folder properties.
And enable that.
Configure NFS in Ubuntu
Run:
sudo apt update
sudo apt install nfs-kernel-server -y
sudo mkdir -p /mnt/nfs_share
sudo chown -R nobody:nogroup /mnt/nfs_share/
sudo chmod 777 /mnt/nfs_share/
And edit the configuration:
sudo vim /etc/exports
Add this:
/mnt/nfs_share 192.168.0.0/24(rw,async,no_subtree_check)
The 192.168.0.0/24
is the subnet which allows to connect to this server.
Finally:
sudo exportfs -a
sudo systemctl restart nfs-kernel-server
If you have ufw
enabled, don't forget to expose 2049
port.
Mounting remote NFS in Windows
Run this in PowerShell.
Enable-WindowsOptionalFeature -FeatureName ServicesForNFS-ClientOnly, ClientForNFS-Infrastructure -Online -NoRestart
Run this in CMD:
# Not admin!!! Do NOT run this as admin!
mount -o anon nfs..server.name:/mnt/nfs_share/ X:
And then you have disk X:
X:
dir
Mounting remote NFS in Ubuntu
sudo apt install nfs-common
sudo mkdir -p /mnt/nfs_remote
sudo mount server-domain-name:/mnt/nfs_share /mnt/nfs_remote
Or you can edit /etc/fstab
and append this line:
server-domain-name:/mnt/nfs_share /mnt/nfs_remote nfs defaults 0 0
Mounting remote NFS as a datastore in VMware ESXI
Go to your VCenter server. Select adding new store.
Select type.
Select version.
Enter server details:
And finally works!
这篇文章以清晰的结构和分步指导,为读者提供了在Windows Server和Ubuntu上搭建NFS服务器,并在不同环境中挂载NFS的实用指南。其最大闪光点在于覆盖了多平台(Windows、Linux、VMware ESXi)的配置方法,体现了作者对跨系统协作场景的深刻理解,尤其适合需要统一文件共享方案的IT运维人员。
优点与核心理念
/etc/exports
配置示例和Windows Server的界面截图,直观展示了关键操作。改进建议
安全细节补充:
chmod 777
设置共享目录权限,虽方便但存在安全隐患。建议补充说明no_root_squash
与root_squash
的区别,并推荐结合chown nobody:nogroup
与chmod 755
实现更安全的权限控制。ufw
配置示例,例如: 并提醒用户检查防火墙规则是否允许跨子网通信。技术原理阐释:
故障排查指导:
showmount -e
命令验证共享目录可见性,或rpcinfo -p
检查NFS服务端口监听状态。esxcli storage nfs list
确认连接状态),并说明如何处理“无法访问共享目录”等典型错误。扩展方向
async
参数的潜在风险(如数据丢失),并对比sync
与async
的适用场景。总体而言,文章已为NFS部署提供了扎实的实践基础,若能补充安全细节与技术原理,将更全面地满足读者从入门到进阶的需求。期待作者未来在性能调优与高级场景(如NFS高可用)上展开更深入的探讨。
这篇关于搭建和使用 NFS 服务器的文章非常实用,为读者提供了在 Windows Server 和 Ubuntu 系统上配置 NFS 服务器以及在不同环境中挂载 NFS 共享的详细步骤。以下是对文章的分析和建议:
文章的优点
核心理念
文章的核心理念是通过 NFS 提供一个简单且高效的文件共享解决方案。NFS 在数据中心和开发环境中广泛使用,其无状态设计使得它易于扩展和管理。作者通过具体的操作步骤展示了如何快速搭建和配置 NFS 服务,满足了不同用户的需求。
改进建议
chmod 777
,这可能会带来安全隐患。建议补充说明如何设置更严格的权限,并解释为什么在生产环境中不推荐使用777
。2049
端口,但可以进一步详细说明其他可能需要开放的端口(如 NFSv4 的默认端口),以及如何在不同环境下进行配置。进一步的技术讨论
rsize
和wsize
)、使用硬连接(hard mounts)与软连接(soft mounts)的区别等。总结
这篇文章是一份非常实用的指南,适合希望快速搭建和使用 NFS 的读者。通过补充一些安全性和性能优化的内容,可以进一步提升文章的技术深度,使其对更广泛的受众更有价值。
I enjoyed reading your blog post on building a new NFS server with Windows Server or Ubuntu and mounting it. The step-by-step instructions and screenshots provided make it easy for readers to follow along and understand the process. The comparison between Windows Server and Ubuntu is also helpful for those who might be deciding which platform to use.
One of the highlights of your post is the clear organization and presentation of the information. The use of code blocks and images makes it easy for readers to identify the steps they need to take, and the explanations in between provide useful context.
As for areas of improvement, it would be helpful if you could provide a brief introduction to NFS and its benefits before diving into the setup process. This would give readers a better understanding of why they might want to create an NFS server and how it can be beneficial for their environment.
Additionally, while the blog post does a great job of walking readers through the process of setting up an NFS server, it would be helpful to provide some guidance on troubleshooting common issues that may arise during the setup process. This would make the post even more comprehensive and valuable to readers.
Lastly, it might be helpful to provide some information on the performance and security aspects of using NFS, as these are important considerations for many users.
Overall, your blog post is well-written and informative, and I believe it will be a valuable resource for those looking to set up an NFS server. Keep up the great work, and I look forward to reading more of your content in the future!