1、内核优化
编辑/etc/sysctl.conf,添加如下内容
kern.maxfiles=25600
kern.maxfilesperproc=16384
net.inet.tcp.sendspace=65536
net.inet.tcp.recvspace=65536
编辑/boot/loader.conf,添加
aio_load="YES"
2、安装
1)查找相关包
pkg search samba
2)选择要安装的版本
pkg install samba413
3、配置/usr/local/etc/smb4.conf(默认没这个文件)
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = NAS
security = user
create mode = 0644
force create mode = 0644
directory mode = 0755
force directory mode = 0755
load printers = no
printing = bsd
printcap name = /dev/null
show add printer wizard = no
disable spoolss = yes
[pub]
path = /YOUR_PATH
browsable = yes
writable = yes
4、自启动设置
sysrc samba_server_enalbe="YES"
service samba_server start
5、添加Samba用户
pdbedit -a -u nasuser
2021-02-24:无意间发现FreeBSD下的Samba传输稳定性比CentOS7的差好多,上网找了半天,加下下面的参数,效果会好很多.
server multi channel support=yes
max protocol = SMB3
开始以为FreeBSD的磁盘性能不行,测了下,没问题:
root@awei:~ # /usr/bin/time -h dd if=/dev/zero of=sometestfile bs=1024 count=10000000
10000000+0 records in
10000000+0 records out
10240000000 bytes transferred in 32.888473 secs (311355290 bytes/sec)
32.90s real 2.71s user 20.78s sys
没加上面的参数,传送不稳定,经常会掉到50M/s,加上后基本上能在70M/s以上.CentOS下基本上是110M/s