samba报错smbd’s max open files = 16384
一般是系统的open flies限制

查看系统限制:
[root@storage ~]# sysctl -a | grep maxfiles
kern.maxfiles: 12328
kern.maxfilesperproc: 11095
kern.openfiles: 8760
FreeBSD 8.2,默认系统打开文件数12328,每进程打开文件数11095,kern.openfiles是系统当前打开文件数。

设置新的系统限制:
[root@storage ~]# sysctl kern.maxfiles=65536
[root@storage ~]# sysctl kern.maxfilesperproc=32768

查看某个进程的系统限制,nofile就是这个进程打开文件数的限制
24443是某个smbd的pid
[root@storage ~]# mount -t procfs proc /proc
[root@storage ~]# cd /proc/24443
[root@storage /proc/24443]# ls -l
total 0
-r–r–r–  1 root  wheel  0 Nov  7 20:15 cmdline
———-  1 root  wheel  0 Nov  7 20:15 ctl
———-  1 root  wheel  0 Nov  7 20:15 dbregs
-r–r–r–  1 root  wheel  0 Nov  7 20:15 etype
lr–r–r–  1 root  wheel  0 Nov  7 20:15 file -> /usr/local/sbin/smbd
———-  1 root  wheel  0 Nov  7 20:15 fpregs
-r–r–r–  1 root  wheel  0 Nov  7 20:15 map
———-  1 root  wheel  0 Nov  7 20:15 mem
———-  1 root  wheel  0 Nov  7 20:15 note
———-  1 root  wheel  0 Nov  7 20:15 notepg
———-  1 root  wheel  0 Nov  7 20:15 osrel
———-  1 root  wheel  0 Nov  7 20:15 regs
-r–r–r–  1 root  wheel  0 Nov  7 20:15 rlimit
-r–r–r–  1 root  wheel  0 Nov  7 20:15 status
[root@storage /proc/24443]# cat rlimit
cpu -1 -1
fsize -1 -1
data 34359738368 34359738368
stack 536870912 536870912
core -1 -1
rss -1 -1
memlock -1 -1
nproc 5547 5547
nofile 32768 32768
sbsize -1 -1
vmem -1 -1
npts -1 -1
swap -1 -1

/etc/login.conf可以配置某个用户的系统资源限制,默认是无限制的,就是受限于系统内核限制

/etc/sysctl.conf里面配置对开机启动的服务无效

/boot/loader.conf里面配置对开机启动的服务有效

直到VMware ESX(i) 4.0 U2,官方的VMware-tools都未提供对FreeBSD 8.0 amd64的支持,因此改为安装Open Virtual Machine Tools。

[root@yaoge123 ~/vmware-tools-distrib]# uname -a
FreeBSD yaoge123 8.0-RELEASE-p3 FreeBSD 8.0-RELEASE-p3 #0: Tue May 25 20:54:11 UTC 2010     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
[root@www ~/vmware-tools-distrib]# ./vmware-install.pl
Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

……
Before running VMware Tools for the first time, you need to configure it by
invoking the following command: “/usr/local/bin/vmware-config-tools.pl”. Do you
want this program to invoke the command for you now? [yes]

Initializing…

Stopping VMware Tools services in the virtual machine:
Guest operating system daemon:                                      done
Unable to copy the source file
/usr/local/lib/vmware-tools/modules/binary/FreeBSD8.0-amd64/vmxnet.ko to the
destination file /boot/modules/vmxnet.ko.

Execution aborted.

[root@www ~/vmware-tools-distrib]# cd /usr/local/lib/vmware-tools/modules/binary/
[root@www /usr/local/lib/vmware-tools/modules/binary]# ls
FreeBSD6.0-amd64        FreeBSD6.3-amd64        FreeBSD7.0-amd64        FreeBSD7.3-amd64
FreeBSD6.0-i386         FreeBSD6.3-i386         FreeBSD7.0-i386         FreeBSD7.3-i386

首先确认是否安装了内核源代码,如果您的系统中没有 /usr/src/sys 这样一个目录, 则说明没有安装内核源代码。安装它最简单的方法是通过以 root 身份运行 sysinstall, 选择 Configure – Distributions – src,选中其中的 base 、sbin和sys。如果提示Warning:  Can’t find the `8.0-RELEASE-p3′ distribution on this……,在Configure – Distributions – Options中修改Release Name为8.0-RELEASE,安装完成后用freebsd-update fetch install更新源代码。

然后再安装Open Virtual Machine Tools
cd /usr/ports/emulators/open-vm-tools-nox11
make install clean

至少支持了使用VMware Tools关机(这是HA所必不可少的)和vmxnet2网卡。

编辑 /etc/login.conf 增加一个language
enutf8|enutf8 Users Accounts:\
:charset=UTF-8:\
:lang=en_US.UTF-8:\
:tc=default:

vipw 编辑ssh登录的用户,在gid后面增加这个language
yaoge123:$1$***:1001:1001:enutf8:0:0:User &:/home/yaoge123:/bin/sh

编辑 /usr/local/etc/rc.d/tomcat6
在java_command=中增加如下内容禁用IPv6
-Djava.net.preferIPv4Stack="true" \
-Djava.net.preferIPv4Address="true" \

相关版本信息:
Apache/2.2.14 (FreeBSD) mod_ssl/2.2.14 OpenSSL/0.9.8k DAV/2 PHP/5.2.12 with Suhosin-Patch mod_jk/1.2.30
javavmwrapper-2.3.4
diablo-jdk-1.6.0.07.02_8
jdk-1.6.0.3p4_14
tomcat-6.0.24
tomcat-native-1.1.20
mod_jk-ap2-1.2.30_1

创建一个raidz1的ZFS pool
test# zpool create zfspool raidz da1 da2 da3
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 23.9G 192K 23.9G 0% ONLINE –
test# zpool status
pool: zfspool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
raidz1 ONLINE 0 0 0
da1 ONLINE 0 0 0
da2 ONLINE 0 0 0
da3 ONLINE 0 0 0

errors: No known data errors

用更大的da4、da5、da6替换原来小的da1、da2、da3继续阅读

创建一个非冗余的ZFS pool
test# zpool create zfspool da1
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 7.94G 110K 7.94G 0% ONLINE –
test# zpool status
pool: zfspool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
da1 ONLINE 0 0 0

errors: No known data errors

增加一个盘,升级为双路mirror
test# zpool attach zfspool da1 da2
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 7.94G 112K 7.94G 0% ONLINE –
test# zpool status
pool: zfspool
state: ONLINE
scrub: resilver completed with 0 errors on Tue Jul 21 21:24:27 2009
config:

NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
mirror ONLINE 0 0 0
da1 ONLINE 0 0 0
da2 ONLINE 0 0 0

errors: No known data errors

如果想直接建立一个双路mirror的ZFS pool用
test# zpool create zfspool mirror da1 da2

再增加一个盘,升级为三路mirror继续阅读