If you are running Mac OS X and upgraded to the recent 10.5.7 and you are using a bluetooth mouse or keyboard, then you are most likely suffering from the same problem that I do: Bluetooth device loses connection to your mac after a few hours of working. and its a real PITA.
I have been struggling with this since I upgraded to 10.5.7 and haven’t found a working solution, until I recently tried this and it worked like a magic:
sudo killall -HUP blued
You only need to open up a Terminal.app window and run this command. This command sends a HUP (hangup) signal to bluetooth daemon, that actually is a soft-reset command. It causes blued to reload the configuration and brings your bluetooth device back to life.
Update 1: The latest bluetooth firmware update from Apple didn’t solve the problem. It still happens (less frequently tough) and needs to kick blued to work.
The traditional (yet very popular) gzip is a single-threaded application from the single-processor/single-core hardware era. Its just fine if you are compressing a few files occasionally, but it become a great pain when you are compressing 32,000 files on an 8-processor server and you suddenly figure out that you are using only 1/8 of your total processor power. Which means you should wait 8 times longer than if you could use all processing power on your machine. I encountered such case in which I should wait about 40 minutes to compress hundreds of gigabytes of a few thousand files, using traditional gzip, while I had one processor doing the whole job and 7 other processors were sitting idle.
So I thought there should be a way to speed-up the process. The most simple method I could use was to open up multiple terminal windows and run parallel copies of gzip, each of them to compress a specific set of files. While this method worked for me, but I was wondering why the gzip itself doesn’t support multi-threading.
The solution: pigz
I came across pigz after searching the internet for a multi-threaded gzip replacement. pigz is a drop-in replacement for gzip that supports parallel compression/decompression when multiple files are involved.
Figure 1: Running “systat -iostat 1” on a FreeBSD 7.2 machine running pigz
Using pigz, I could exploit more than 70% of my processing power. pigz also maintains compatibility with standard gzip command line parameter and supports all switches while adding “-p” command to specify maximum number of compression threads.
I am type of person who likes to build everything from source code in FreeBSD to get better performance and other customizations. It has become a habit to play with ports tree and system source code and now I believe I have my own template for various server platforms.
One of the most important parts of each configuration template is the /etc/make.conf file. This is were you can change general behavior of the build system. This file is where you actually say which compiler optimizations should be used or what options has to be considered as defaults. Good news is that ports collection as well as the operating system itself honor these configuration.
Here is how a typical make.conf on one of my boxes look like:
CPUTYPE?=nocona
CFLAGS= -O2 -pipe -fno-strict-aliasing
COPTFLAGS= -O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing
KERNCONF= SERVER GENERIC
OPTIMIZED_CFLAGS= YES
WITHOUT_X11= YES
BUILD_OPTIMIZED= YES
WITH_CPUFLAGS= YES
WITHOUT_DEBUG= YES
WITH_OPTIMIZED_CFLAGS= YES
NO_PROFILE= YES
BUILD_STATIC= YES
The CPUTYPE variable tells gcc to optimize generated binary code for specified processor. In this case I am using 64bit Xeon processor architecture and “nocona” is the correct CPUTYPE to use. You may want to use “pentium4” on a typical Intel P4 CPU. A list of possible CPUTYPE values can be found in the sample make.conf file located at /usr/share/examples/etc/make.conf.
Continue reading 'make.conf in FreeBSD'»
I suddenly came across this old post from 2004 in which I explained my early experiments in OS X. Now after being a hardcore OS X user for more than a year, I found how much the world has changed since. The Firefox is a really usable browser now and IM clients are up to date. I still hate iChat for no good reason. Maybe because I hate IM on the whole.
And guess what. My favorite OS X app is Terminal.
In fact OS X offers an intuitive interface that is very usable and hassle-free. I would call it a real productivity booster. Beside the interface, the OS itself is based on a mature BSD skeleton, and as a Unix fanatic and really enjoy poking around OS X.
I seriously urge you to switch to Mac if you care about your productivity and performance.
Keeping accurate time on a host (either a server or a workstation) is important because:
1- You need to know accurately when you should go for lunch or back home
2- You need accurate time in your event log files for further analysis
3- Many programs need to have the correct date and time to function (e.g. MTA)
4- You need correct timestamps on your files
Given above facts, you will need to enable NTP on your hosts and keep your system clock in sync with public time servers.
First you should make sure that your timezone setting is correct. The latest timezone information can be updated by installing “zoneinfo” port from /usr/ports/misc/zoneinfo:
# cd /usr/ports/misc/zoneinfo/
# make install clean
and run tzsetup(8) to make sure you have selected the correct timezone.
Now, to enable automatic time sync during system startup, you need to add a few lines to your /etc/rc.conf file:
ntpdate_enable="YES"
ntpdate_flags="-b pool.ntp.org"
This will make your system to sync the clock upon startup. I use NTP pool at “pool.ntp.org” that suggests a NTP server from a large pool of available time servers. However you may use your favorite/local NTP server.
You can also synchronize your time manually by invoking ntpdate(8) from command line, passing an NTP server address to it:
# ntpdate time.nist.gov
I managed to migrate my blog to WordPress after more than 5 years. I had a bad feeling about the old MT and perhaps that was the reason I was not posting too often.
I redirected the old feed URLs to the new one, but I suggest you update your links and let me know if you are having difficulties accessing content on this website.
So after a while, I finally managed to launch a website for my book, “Network Administration with FreeBSD 7“. The new website is actually a blog and I would cross-post the topics related to the book on both websites.
I would really appreciate your feedbacks on the current book and suggestions for future editions.

Network Administration with FreeBSD 7 is the book that I have been working on for past year. And now it is published by Packt and is available for purchase from various bookstores.
This book is something that I have been looking for since I started with FreeBSD back in 1997. I needed a practical book with working examples of how to optimize my FreeBSD installations for various types of applications. And I never found that book, until I recently decided to write one.
“Network Administration with FreeBSD 7” is unique in several ways:
- I tried to cover the exciting new features and improvements introduced in FreeBSD 7
- It is full of tips and tricks on how to optimize your installation from optimizing disk I/O, network, virtual memory, etc.
- It covers IPv4 and IPv6 configuration as well and bridging and routing in FreeBSD
- It has working examples of different IPSec, GRE, PPP and GIF scenarios
- I tried to cover Jail virtualization in working real world examples
- Keeping your system up to date and customizing system for specific applications is thoroughly covered
I tried to stop telling stories in the book and give more real world examples instead, so reading this book would not make you smile
An article named Tunneling with FreeBSD (taken from book) is also available on PACKT website.
Update: The book has its own website at http://freebsdbook.com
I accidentally noticed today that my recent WebKit nightly 31667 passes ACID3 test flawlessly.

Kudos to WebKit team for their great browser!
I came across this interesting article about upcoming FreeBSD 7 that outlines some of the most important changes in this release.
The upcoming release of FreeBSD 7 is a major milestone for all FreeBSD developers and users. It is the most amazing release I have ever had the chance to play with. There are plenty of new features and many improvements, especially in networking (which is my area of interest).
I have had this chance to play with MySQL 5.1 running on FreeBSD 7 on top of 8 cores of Xeon processor in 64-bit mode. My impression was that it was almost as fast as kris’s benchmarks and totally kicked linux 2.6 in threading and SMP performance.
This is something I expected to see in FreeBSD 6. However FreeBSD seems to be catching up with linux again.