Again the problem encountered, continue to do record backup.
For file sharing between servers, NFS sharing settings are required, and the server is Ubuntu 12.04 64 bits.
Preparing the Environment
Server Two units:
Service side: 192.168.1.1
Client: 192.168.1.2
Service-side operations
1, install the NFS service first (the following actions switch root user)
Apt-get Install Nfs-kernel-server
2, after the installation is complete, edit the settings file:
Vi/etc/exports
The newly installed is an empty file, with only a partial comment, which is added below:
/mydata 192.168.1.2 (Rw,sync,no_root_squash,no_subtree_check)
Interpretation:
/mydata: The name of the folder to be shared locally;
192.168.1.2: For access to the server address, you can also write *, or 192.178.1.* such wildcard characters;
RW: Read and Write permissions
Sync: Synchronous write memory and hard drive
No_root_squash:root users have all permissions
No_subtree_check: Do not check the parent directory permissions in the shared folder
If you share multiple directories, add more than one line.
3, restart NFS related services
/etc/init.d/portmap restart
/etc/init.d/nfs-kernel-server restart
4, view the shared directory
Showmount-e
The server-side installation is complete, and the next operation accesses the server side.
Client (server to access)
1, the same installation of NFS services
Apt-get Install Nfs-kernel-server
2, to mount the shared folder locally, first create a folder on the local server to mount the shared folder.
mkdir Nfsdisk
Next Mount:
Mount-t NFS 192.168.1.1:/mydata/nfsdisk
Note: The above operation requires root permission, the address in the above command is the main server's address followed by the colon and the main server shared folder address, followed by a space, followed by the local folder to be mounted.
You can try to create a file or folder, and then return to the primary server to see if the directory appears.
Additional actions
1, cancel the Mount
sudo umount/netdisk
If prompted "device is busy" to indicate that the directory is in use, use the following command:
Fuser-km/netdisk
Df-lh
And then perform the umount operation
2, add boot mount automatically
Vi/etc/rc.local
Before exit (), add the Mount command above:
Mount-t NFS 192.168.1.1:/mydata/nfsdisk
3, commonly used parameters
Ro read-only access
RW read-write access
Sync write data to memory and hard drive
Async data is temporarily stored in memory, not directly to hard drive
Secure NFS send via secure TCP/IP port under 1024
I Nsecure NFS sends
Wdelay over 1024 ports If multiple users are writing to the NFS directory, group write (default)
No_wdelay If multiple users are writing to the NFS directory, write now and do not need this setting when using Async.
Hide does not share its subdirectories in an NFS shared directory
No_hide a subdirectory of the shared NFS directory
Subtree_check to force NFS to check the permissions of the parent directory (default)
When sharing subdirectories such as/usr/bin No_ Subtree_check and above, do not check the parent directory permissions
All_squash the UID and GID of shared files map anonymous users anonymous, suitable for public directories.
No_all_squash preserves the UID and GID (default) for shared files
Root_squash all requests for root users are mapped to the same permissions as anonymous users (default)
No_root_squash Root user has full administrative access to the root directory
Anonuid=xxx Specify the UID of anonymous users in server/etc/passwd files for NFS
Anongid=xxx Specify the GID for anonymous users in server/etc/passwd files for NFS
Finished.