Subtle Indicator You've Been at the CLI Too Long Today
What you see:

What you think:

Installing an Intel X25-E SSD on FreeBSD 8.1
This is on an existing FreeBSD install. I'm not booting from the SSD; I'm just adding it so it will show up at /var/cache.
# mkdir /var/cache
I installed the solid-state drive on a Dell OptiPlex 755. I unplugged the SATA cable from the DVD-ROM drive (who uses optical media anymore?) and connected the cable from SATA1 on the motherboard to the SSD.
When booting, FreeBSD found the drive:
ad10: 61057MB at ata5-master UDMA100 SATA 3Gb/s
Next, I formatted it using sysinstall and fdisk using the information found in the FreeBSD Handbook. The only special thing I did was to add Newfs Opts in the Disklabel Editor to add -i 1024 since I know I'm going to have a gazillion small files and didn't want to run out of inodes.
I knew what to put in fstab by looking in the DiskLabel Editor under the "Part" column.
Here's my new /etc/fstab.
# Device Mountpoint FStype Options Dump Pass#
/dev/twed0s1b none swap sw 0 0
/dev/twed0s1a / ufs rw,noatime 1 1
/dev/twed0s1d /tmp ufs rw,noatime 2 2
/dev/twed0s1e /usr ufs rw,noatime 2 2
/dev/twed0s1f /var ufs rw,noatime 2 2
/dev/ad10s1d /var/cache ufs rw,noatime 2 2
Drupal In BSD Magazine
Drupal is featured in the October 2010 issue of BSD Magazine (email address required to download).
Using Mac OS X 10.6 to Create a Bootable FreeBSD 8.1 Installer on a USB Memory Stick
Warning. Follow these instructions at your own risk. I am not responsible when you use dd to blow away your kitty pictures.
Download the FreeBSD 8.1 memory stick image from a FreeBSD repository. I picked one from here.
Plug in your USB stick. OS X will mount it.
You want to unmount the volume while keeping the drive available. To do this, open Disk Utility, click on the name of the mounted volume, and click the Unmount button.
Now you need to know the disk's identifier. You can find this out by right-clicking the disk in Disk Utility. The disk identifier of my USB stick was disk4.

Finally, copy the memory stick image onto the memory stick, substituting the disk identifier into this terminal command. if means "in file" and of means "out file".
dd if=/path/to/freebsd.img of=/dev/diskidentifier bs=10240 conv=syncSo the commands I issued looked like this (yours will be different, since your disk identifier will be different).
dd if=/Users/john/Downloads/FreeBSD-8.1-RELEASE-amd64-memstick.img of=/dev/disk4 bs=10240 conv=syncWhen it's done, dd says:
105018+0 records in
105018+0 records out
1075384320 bytes transferred in 1310.732002 secs (820446 bytes/sec)That's 22 minutes.
Back to Disk Utility. Select the memory stick. Click the Eject button. Now go boot FreeBSD!
Effects of Changing vfs.ufs.dirhash_maxmem in FreeBSD
I have a busy web frontend server many files in a single directory. The server is running FreeBSD 8 amd64. Here is the result of changing the sysctl vfs.ufs.dirhash_maxmem to 67108864. Note the change in system (red) area. The vertical arrow shows when the change was made:

Recovering from a terminal full of gibberish
Have you ever accidentally tried to view a binary file and your terminal started spewing all sorts of weird characters?
$ cat /etc/localtime
???w?qˈ???#?p?a???u??@???U?? ???5?????????????
???s??ޗ?ݩ?py?߉rp??[??iTp?~=??I6p?^?
pa
?p@?0?p?'? ?p ??
?p
???
?u???????t??tyV?iVY8?I89?)"7?p???p?????p?܀??p v!??p"U?#j??$5?%J??&?'*??'?р)
p???q5?ro??s?tO??t??v8?pv?πx?px???y?hpz???{?Jp|~u?}?,p~^W??GәI
????????LMTCDTCSTESTCWTCPT
CST6CDT,M3.2.0,M11.1.0
▒⎼±␋⎺⎻␊#
The solution is to type reset and hit return.
▒⎼±␋⎺⎻␊# ⎼␊⎽␊├
Erase set to backspace.
$
There. All better.
Performance presentation, Des Moines Web Geeks
Matt Nuzum, the webmaster of ubuntu.com, invited me to speak at the Des Moines Web Geeks meeting last night. The venue, Impromptu Studios, was a bit hard to find. There were no signs for Impromptu Studios, but after lurking in dark alleyways for a while I eventually discovered what should have been obvious from the beginning: enter the furniture store with the "Closed" sign on the front and go up the stairs past the disused lavatory with a sign on the door saying "Beware of the Leopard."
The group was great and we talked for about an hour and half about bottlenecks and optimization. I even went home with a Django book!
Since this was a diverse group I tried to talk about things that everyone has to deal with (bottlenecks for storage, network, memory and CPU) rather than anything Drupal-specific.
As promised, last night's slides: Performance, Scalability on the Server Side (PDF, 1MB).
Watching traffic on FreeBSD
Ben Wong at MostlyGeek pointed out that a great way to watch traffic on FreeBSD is the command systat -ifstat 1 which shows:
/0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /10
Load Average ||
Interface Traffic Peak Total
lo0 in 0.000 KB/s 0.000 KB/s 4.122 MB
out 0.000 KB/s 0.000 KB/s 4.122 MB
bge0 in 6.181 KB/s 36.944 KB/s 1.666 GB
out 110.521 KB/s 670.040 KB/s 3.444 GB
Transparent bridging firewall
I had occasion today to set up a transparent bridging firewall. It's basically a computer that sits on the wire and silently drops packets matching certain rules.
In my case I wanted to restrict traffic to certain subnets without disturbing anything. So I took an Pentium Pro based HP Vectra (I'm telling you, those old HPs never die!) and put in two PCI-based ethernet cards, an Intel card and a trusty 3Com 905. It was nice that I had two different cards lying around, since they can be easily identified within FreeBSD by their separate interfaces (fxp0 and xl0, respectively). I installed FreeBSD 6.2 from a CD with minimal settings -- in particular, I declined to configure the network interface cards.
After install, I added the following line to /boot/loader.conf:
if_bridge_load="YES"
Added the following lines to /etc/rc.conf to force the two ethernet interfaces up and set up the bridge.
ifconfig_fxp0="up"
ifconfig_xl0="up"
cloned_interfaces="bridge0"
ifconfig_bridge0="addm fxp0 addm xl0 up"
firewall_enable="YES"
firewall_type="/etc/rc.firewall.local"
firewall_quiet="YES"
firewall_logging="YES"
Added the following to /etc/sysctl.conf:
net.link.bridge.ipfw=1
net.link.bridge.ipfw_arp=0
Then I added ipfw rules to /etc/rc.firewall.local.
Note that I did not assign an IP address to either network card. That means the only way into the machine is through the console, and the only way to tell that it's there on the wire is to guess because response time is a tiny bit longer.
So far it looks like even a Pentium Pro is overkill.



