UbuntuServer12.04NFS file sharing settings

Source: Internet
Author: User
NFS file sharing can solve the problem of file sharing in the cluster environment, such as fragments and attachments. Now we assume there are two machines, 192168110 and 192168111. We use 192168110 as the server and 192168111 as the client. I. server operation 1 installing NFS server [plain] s NFS file sharing can solve the problem of file sharing in the cluster environment and attachments. Suppose there are two machines 192.168.1.10 and 192.168.1.11. We use 192.168.1.10 as the server and 192.168.1.11 as the client. 1. server operation 1. install NFS server [plain] sudo apt-get install nfs-kernel-server 2. open the/etc/exports file and add [plain]/home/zdw * (rw, sync, no_root_squash) at the end./home/zdw is the directory you want to share *: allow all network segments to access rw: read and write permissions sync: data synchronization write internal and hard disk no_root_squash: nfs client shared Directory user permissions if you need to specify only a specific network segment (such as 192.168.1.1 ~ 192.168.1.192) you can set [plain] sudo/usr/local/www/192.168.1. * (rw, sync, no_root_squash, no_subtree_check) you can also manually specify multiple network segments [plain]/usr/local/www/192.168.1.10 (rw, sync, no_root_squash, no_subtree_check) 192.168.1.11 (rw, sync, no_root_squash, no_subtree_check) multi-directory sharing add multiple rows. 3. restart the service [plain] sudo/etc/init. d/portmap restart <--- restart portmap, sudo/etc/init. d/nfs-kernel-server restart <--- restart the nfs service showmount-e <--- display the shared directory 2. client operation 1. install nfs-common or nfs-kernel-server [plain] sudo apt-get isntall nfs-common or [plain] sudo apt-get install nfs-kernel-server 2. mount [plain] sudo mount-t nfs 192.168.1.10: the/usr/local/www command has mounted the/usr/local/www directory on 10 to/usr/loca/w of the client. Ww directory. You can create a file in the mounted directory on the client for testing. [Plain] sudo touch 1.txt is added to the server to check that the file already exists and is shared successfully. 3. unmount [plain] sudo umount/usr/local/www. if the system prompts "/usr/local/www device is busy" when the mounting is canceled, the directory is in use, the mounting cannot be canceled. Here we can execute the following command: [plain] fuser-km/usr/local/www df-lh and then execute the umount command. 4. if you want to enable automatic mounting upon startup, you can perform automatic mounting at/etc/rc. run the sudo mount-t nfs 192.168.1.10:/usr/local/www command before exit 0 in the local file. III. Appendix NFS common parameters [plain] ro read-only access rw read/write access sync all data written into shared async nfs upon request before writing data can respond to the request secure nfs through secure TCP below 1024 /IP port sending insecure nfs send wdelay over port 1024 if multiple users want to write to the nfs Directory, group write (default) no_wdelay if multiple users want to write data to the nfs Directory, write the data immediately. this setting is not required when async is used. Hide does not share its subdirectory in the nfs shared directory. no_hide shares the subdirectory subtree_check of the nfs Directory. if you share a subdirectory such as/usr/bin, force nfs to check the permissions of the parent directory (default) no_subtree_check is relative to the preceding one. if you do not check the permission of the parent directory all_squash, the UID and GID of the shared file are mapped to the anonymous user anonymous, which is suitable for public directories. No_all_squash retains the UID and GID of the shared file (default). all requests of the root_squash root user are mapped to the same permissions as those of the anonymous user (default) the no_root_squas root user has full management access permissions to the root directory. anonuid = xxx specifies the nfs server/etc/passwd file. the UID anongid = xxx specifies that the nfs server/etc/passwd file is anonymous. user GID
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.