LINUXNFS optimization and automatic mounting autofs

Source: Internet
Author: User

Mount-t nfs-o nosuid,noexec,nodev, rw 192.168.10.10:/data/mnt

# grep Mnt/proc/mounts

192.168.10.10:/data//mnt nfs4 rw,nosuid,nodev,noexec, relatime,vers=4,rsize=131072,wsize=131072,namlen= 255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.10.11,minorversion=0,local_lock=none, addr=192.168.10.10 0 0

Noexec is forbidden to run a readable program, only the execution of the command itself, not counting the interpreter.

Nosuid,noexec for Shell, PHP execution is possible ...  But the interpreter will be gone. (security option)

# ll RM

-rwsr-xr-x 1 root root 57440 March 00:08 rm

#./rm/tmp/xx

-bash:./RM: Insufficient permissions


Server-side

# Cat/var/lib/nfs/etab

/data 192.168.10.0/24 (rw,sync, Wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash, No_ Subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,no_all_squash)

Client # umount-lf/mnt/Forced uninstallation

192.168.10.10:/data//mnt nfs4 rw,nodev,relatime,vers=4,rsize=131072,wsize=131072, namlen=255, Hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.10.11,minorversion=0,local_lock=none,addr =192.168.10.10 0 0


# mount-t Nfs-o nosuid,noexec,rsize=1024,wsize=1024,rw 192.168.10.10:/data//mnt

Test performance

# time DD If=/dev/zero of=/tmp/testfile bs=9k count=2000

Recorded 2000+0 read-in

Recorded the writing of 2000+0.

18432000 bytes (MB) Copied, 3.37836 sec, 5.5 mb/sec

Real 0m3.526s

User 0m0.002s

SYS 0m0.257s

Remove rsize=1024,wsize=1024 After removing read/write Restrictions

18432000 bytes (MB) Copied, 0.833856 sec, 22.1 mb/sec

Real 0m0.842s

User 0m0.001s

SYS 0m0.065

# mount-t Nfs-o nosuid,noexec,noatime,nodiratime, rw 192.168.10.10:/data/mnt/

Read file

# Time for ((i=1;i<5000;i++)); Do cat/mnt/test.sh >/dev/null;d One

Real 0m6.804s

User 0m0.920s

SYS 0m2.325s

6.4 X86_64 Recommended

Mount-t nfs-o noatime,nodiratime,nosuid,noexec, nodev,rw,bg,hard,intr,rsize=131072,wsize=131072 192.168. 10.10:/data/mnt

Simple performance optimization

Mount-t nfs-o noatime,nodiratime,rsize=131072,wsize=131072 192.168.10.10:/data/mnt

View # Grep/mnt/proc/mounts


Official optimisation

# Cat/proc/sys/net/core/rmem_default receive socket buffer size

124928

# Cat/proc/sys/net/core/rmem_max

124928

Command line

# echo 8388608 >/proc/sys/net/core/rmem_default

# echo 16777216 >/proc/sys/net/core/rmem_max


NFS Production Environment Kernel optimization

Cat >>/etc/sysctl.conf <<eof

Net.core.wmem_default = 8388608 W Send

Net.core.rmem_default = 8388608 R receive

Net.core.rmem_max = 16777216

Net.core.wmem_max = 1677216

Eof

Sysctl-p

Mount-lf/mnt Force cancellation of Mount

Server side mount:/data 192.168.10.10/24 (rw,async,all_squah,anonuid=555,anongid=555)

Client:rsize,wsize,noatime,nodirtime, Nosuid,noexec,soft (HARD,INTR)


Showmount-e

Exprtfs-o RW

Rpcinfo-p

Firewall command

Iptables-a input-s 192.168.10.10/24-j ACCEPT

# Cat/var/lib/nfs/etab

# Man Exports


C6 Client:


AutoFS Auto Mount

Autofs.x86_64:a tool for automatically mounting and unmounting

: filesystems


# yum-y Install AutoFS

There may be a lot of problems with Yum remove

#/etc/init.d/autofs Start

# cat/etc/auto.master configuration file

/mnt/etc/auto.misc--timeout 10 (cancellation after 10 seconds of exit)

#vi/etc/auto.misc Action

Nfsdata-fstype=nfs 192.168.10.10:/data

Last Mount details: hidden

192.168.10.10:/data 18G 2.5G 14G 15%/mnt/nfsdata

# cat/etc/sysconfig/autofs Configuration Parameters


Other commands

Uname-r/-m

GREP-E/-V "#|^$"

data and 7x24


This article is from the "what-all" blog, please be sure to keep this source http://hequan.blog.51cto.com/5701886/1760940

LINUXNFS optimization and automatic mounting autofs

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.