Sunday, December 12, 2010

ZFS pools surveillance using Nagios and NRPE

Just short post: I have found this useful and almost out-of-box working HOWTO. Thanks.

(One small issue was that path to zpool binary on FreeBSD is /sbin/zpool, not /usr/sbin/zpool. Trivial change.)

Wednesday, November 17, 2010

Hibernation on Debian unstable (sid) sucks badly

As the header says... It sucks completely. Basically what you need to make hibernation working on pretty decent laptop like for instance ThinkPad X301 as in my case? First you need running Debian of course, SWAP partition of sufficient size (= greater than your RAM:-)) and install packages hibernate and uswsusp. Then try it... For instance run s2disk or click on some button on your Gnome/KDE/... desktop. It should hibernate (some percentage growing, disk working and then it is off), hopefully.

When you turn it on you may see message:
Invalidating stale software suspend images
and then the systems boot from scratch like it has beeing rebooted... What the fuck? Well in my case the

resume=swap:/dev/sda2

line was missing in /boot/grub/grub.cfg.

Well, you can add it there by hard. (Why it is not there by default? Well I am not a Debian guy, so I do not even know where to fill the bug actually, but I am providing a hack. Stone me.) Just add something like this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=swap:/dev/sda2"

to file /etc/default/grub.

That't it. It worked for me.

Saturday, September 4, 2010

gtkam: Could not initialize camera.

I have Canon Ixus 80IS. Canon cameras have "a feature" that they are not a USB mass storage. Maybe they have some fucking reason for this, noone knows...

Under Linux, one needs gphoto2 in order to download photos from the camera on USB. And one also needs usbfs mounted to /proc/bus/usb and of course one needs proper permissions. For example on current Debian unstable I had to add this line to /etc/fstab:
none  /proc/bus/usb  usbfs  defaults  0  0
And one also needs a user accessing the camera to be in group plugdev. Permissions on devices in /proc/bus/usb/... are set by some of beasts like udev/hal/wtf. No matter, plugdev did the trick for me.

Thursday, August 19, 2010

Low throughput with www/apache22 on FreeBSD 8.1

Few days ago I installed FreeBSD 8.1 and compiled Apache 2.2.15 from port www/apache22. I tried to transfer some files over the internet with rather good connection (100Mbps in the weakest point, but several hops resulting in RTT ~27ms). But I got only 10 – 15Mbps throughput from FreeBSD on hi-end HW. I also tried to install FTP server (ftp/proftpd) but I got the same result. It was not a network issue or a client problem, because I had full speed transfers from another machine in the same network. What the fuck?

Step one… Sysctl parameters. The most fucking evil parameter is net.inet.tcp.inflight.enable. Disable it! Actually I tuned more parameters relevant to TCP/IP stack and kernel internals:

/etc/sysctl.conf
kern.ipc.maxsockbuf=16777216
kern.ipc.nmbclusters=32768
kern.ipc.somaxconn=32768
kern.maxfiles=65536
kern.maxfilesperproc=32768
kern.maxvnodes=800000
net.inet.tcp.inflight.enable=0
net.inet.udp.maxdgram=57344
net.inet.udp.recvspace=65536
net.local.stream.recvspace=65536
net.inet.tcp.sendbuf_max=16777216

OK, transfers over FTP were then running at 100Mbps. Fine. But HTTP file transfers were still fucking slow. Locally it was two times slower than FTP and much more slower over the internet (HTTP: 4-10 Mbps vs. FTP: 100Mbps).

Step two... Turning off sendfile(2) in Apache HTTPd.

This is also incredibly fucking option and there is no documentation pointing at it... Even Google does not know what to do when the Apache fucks up on FreeBSD 8.1. Well, I added one single line to /usr/local/etc/apache22/httpd.conf:

EnableSendfile off

And that's it. Both FTP and HTTP are running at full speed.