Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to mount NFS share in Linux system

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Linux system how to mount NFS sharing, the article is very detailed, has a certain reference value, interested friends must read it!

NFS is the abbreviation of Network File System and network file system. The main function of NFS is to share files or directories between different host systems through the local area network.

To install the NFS client package to mount the NFS share on the Linux system, you first need to install the NFS client package. Package names vary from Linux to Linux distribution.

Install the NFS client on Ubuntu and Debian:

Sudo apt update sudo apt install nfs-common in CentOS and RedHat:

Sudo yum install nfs-utils manual mount NFS file system mounting a remote NFS share is the same as mounting a regular file system.

To mount the NFS file system at a given mount point, use the mount command in the following format:

Mount [OPTION...] NFS_SERVER:EXPORTED_DIRECTORY MOUNT_POINT use the following steps to manually install a remote NFS share on a Linux system:

First, create a directory as the mount point for the remote NFS share:

The sudo mkdir / var/backups mount point is the directory on the local computer where the NFS share is to be mounted.

Mount the NFS share sudo privilege by running the following command as root or user:

Sudo mount-t nfs 10.10.0.10:/backups / var/backups where 10.10.0.10 is the IP address of the NFS server, / backup is the directory export where the server is located, and / var/backups is the local mount point.

When successful, no output is generated.

If you want to specify other mount options, use the-o option. You can provide multiple options as a comma-separated list. For a list of all installation options, enter man mount in the terminal.

To verify that the remote NFS volume has been mounted successfully, use the mount or df-h] command.

Once the share is installed, the mount point becomes the root of the mounted file system.

When you manually install a share, the NFS share installation does not persist after a reboot.

Automatically mount the NFS file system using / etc/fstab

Typically, you need to mount the remote NFS directory automatically when the system starts.

The / etc/fstab file contains a list of entries that define where and how to mount the file system when the system boots.

To mount the NFS share automatically when the Linux system starts, add a line to the / etc/fstab file. This line must contain the hostname or IP address of the NFS server, the exported directory, and the installation point on the local computer.

Use the following procedure to automatically install NFS shares on Linux systems:

Set up the mount point for the remote NFS share:

Sudo mkdir / var/backups opens the / etc/fstab file using a text editor:

Sudo nano / etc/fstab add the following line to the file: / etc/fstab

# 10.10.0.10:/backups / var/backups nfs defaults 00 where 10.10.0.10 NFS server IP address, / backup is the export directory, and / var/backups is the local installation point.

Run the mount command to mount the NFS share:

The mount / var/backups mount 10.10.0.10:/backupsmount command reads the contents of / etc/fstab and installs the share.

The NFS share will be mounted automatically the next time the system is rebooted.

The unmount NFS file system umount command detaches (unmounts) the mounted file system from the directory tree.

To uninstall an installed NFS share, use the umount command, followed by the directory or remote share that has been installed:

Umount 10.10.0.10:/backups umount / var/backups if there is an entry in the fstab file of the NFS bracket, delete it.

"when using mounted volumes, the umount command cannot detach the share." To find out which processes are accessing the NFS share, use the fuser command:

After fuser-m MOUNT_POINT finds the process, you can use the kill command to stop it, and then uninstall the NFS share.

"if you still have problems unmounting a share, use the-l (--lazy) option, which allows you to unmount a file system as soon as it is no longer busy."

"if umount-l MOUNT_POINT cannot access the remote NFS system, use the-f (--force) option to force the uninstall."

In general, using the force option is not a good idea for umount-f MOUNT_POINT, as it can corrupt data on the file system.

The above is all the contents of the article "how to mount NFS sharing in Linux system". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report