About 2 months ago, I had a spare VPS at my host, Hetzner. So I decided to play with FreeBSD which was being offered for Hetzner servers and VPSes.
That’s how the whole thing started. I didn’t have much problems getting the concepts because it belongs to *nix family of OSes and I have been a pure Linux user since 2008.

First of all the basic difference between FreeBSD and GNU/Linux is that Linux is just the kernel and GNU is the userland. In layman’s terms, the hardware interface is called Linux, while the rest of the part: the shell, core tools, etc are GNU.It’s a piece from there, another from somewhere else and merging the whole thing into one collectively known as GNU/Linux. Linux itself cannot boot without GNU and GNU will not work without Linux (Yes, there is a GNU kernel project called GNU Hurd, but I don’t how far that went).
In FreeBSD, the whole thing is a complete unit. FreeBSD was derived from the original AT&T Unix and open sourced. You can read more about the differences at over-yonder.

So, while playing with my VPS, I found a major difference between Linux and FreeBSD: performance and memory usage. The performance was nearly same as Linux, but slightly better. Memory usage change, was drastic. FreeBSD is just too good at managing memory. My server earlier used to consume over 1 GB of memory for running PHP, MySQL and Nginx. Now, it doesn’t even touch 500 MB! It’s always less than 500 MB. Everything is just same, configuration, etc. Only OS changed.
After the trial VPS, I started moving my stuff from the Gentoo VPS to the new one. Ran it for testing few days, and it continued to amaze me. FreeBSD’s official slogan is “The Power to Serve”. So much true is that! And that ended up as migrating other VPSes to FreeBSD as well.

Meanwhile, I was facing a lot of insufficient memory issues on my desktop, which is a five year old Pentium Dual Core 2 Ghz (E2180) with 3 GB memory. It used to swap out so much; I did try tweaking vm.swappiness, but it still maxed out on memory. After the great experience on my servers, I decided to move my desktop to FreeBSD. Since my hardware doesn’t involve any crazy things like Nvidia GPU or something, it was an easy task. The problem comes with migrating data, FreeBSD <-> Linux data read/write is not so friendly. This was solved by using my external HDD as a tape drive, I just wrote the whole data as a tar archive to the disk 😀 and restored it after installing FreeBSD. Got this great tip from ##FreeBSD @ FreeNode.

Downloaded memstick image [who uses CD/DVD these days, anyway?] of FreeBSD and it booted. It has a simple command line installer — If you’re a Ubuntu/Fedora user, please install Arch/Gentoo first to get the taste of how command line installation works. Also it is useful to have another computing device which can help you ask for issues or Google around for stuff if you get stuck. The FreeBSD handbook is quite thorough and easy to follow. In my case the another computing device was my Nexus 4. Used it to chat on the FreeBSD IRC channel to ask for help when I got stuck and also search around. 🙂

The base installation was complete within 10 minutes, if you remove the time spent in solving issues and the issues were barely because my drive configuration is bit different than normal desktop users: I have one SSD and 3 HDDs. I use SSD for the OS and put these HDD on software RAID-0 for performance, backing up data regularly to an external disk. It is not so simple to do RAID-0 striping in FreeBSD, particularly if you come from Linux background. You need to have similarly sized disks, otherwise it won’t stripe. In my case, I have 2 x 500 GB and 1 x 160 GB. So effectively I can use only two disks in stripe. But I want large storage, so the solution is using stripe and concatenate together.

 The two commands do this: Create a stripe of two disks, ada1 and ada2 which are each 500 GB and then concatenate the third disk to the raid array. The effect of this is, you get whole 1.16 TB for use, while RAID works for the first 1 TB part of the disk. Once the concat disk has been created, it can be partitioned using gpart.

Partitions done: I placed swap, /var, /usr/ports/usr/src on the initial part of the concatenated disk, i.e. /dev/concat/disk and /home with the remaining part. Reason: Those directories have large disk
accesses. Home also does, but only a small part of it would be outside the raid array. There is no filesystem confusion in FreeBSD unlike Linux: There is just one filesystem you need to use for everything: UFS2. It supports everything a modern computer would need, SSD TRIM support too. Simplicity. And there are not many parameters that can be tweaked. Just enable soft updates while formatting (enabled by default) and soft updates journal to prevent data loss in case of a power failure.

The raid array and concatenation partitions need to be done manually before installing. When the memstick boots, you’ll be greeted with the installer, with an option to exit to shell. Exit to the shell and read the manual pages (and the handbook on your another computing device, as well). Create the partitions and enter installer again by just typing the command bsdinstall.

All that stuff is not at all needed if you have a simple disk configuration.

Once base system has been installed: It’ll just give you a black screen. There is no GUI or anything. You need to install everything yourself using the package manager or ports. The FreeBSD ports system is very, very powerful. You can choose what options are enabled in a particular application and install it without unwanted dependencies. For instance, you don’t want PulseAudio, disable it. Gentoo is quite similar here (because it was developed from the idea of FreeBSD’s ports system), with every package being controlled by USE-Flags. But the difference here is, you need to compile everything on Gentoo, including the core system. In FreeBSD, you get core system updates from the community, tested
properly. All extra applications need to be installed and managed by you. Also, there is a binary package repository from where you can install packages directly, not having to compile them with manually. But in order to do that, you must not convert the package database to the next generation package manager pkgngpkgng installation repositories are not ready yet. I chose the ports way, since I like to keep my system slick and exactly what I want; which was one of my reasons why Gentoo was my favorite Linux distribution.

Configuring GUI on FreeBSD isn’t really a big deal, if you know what and where to look for. Like how to tweak fontconfig to get clean & beautiful fonts, etc.

Currently running FreeBSD 9.1-RELEASE-p3 (it has to be updated after installation of 9.1-RELEASE) with KDE. Firefox-10 tabs, Thunderbird running and KDE. Memory usage is 700M. While I did the same on Linux, memory usage used to go beyond 1 GB and no soon it’d start swapping if I launched more tabs in Firefox. To my surprise, even Chromium doesn’t seem to hog memory on this super-polished OS. Chromium with a couple of tabs, along with Firefox and Thunderbird. Memory usage never went beyond 1.5 GB. In Linux, it’d swap 50-100M there by making it ridiculously slow.

The only things I miss are: Dropbox and Android SDK (adb and fastboot to play with kernels, ROMs and stuff on my phone). Even VirtualBox works and I have got USB support working on it, so it shouldn’t be a big deal to run Arch Linux in a VM and use adb  and fastboot fastboot  from there while exporting the Dropbox folder from Arch VM and connecting it to my system folder, I’ll try that and do that as a separate post when I have time.

FreeBSD gave my computer a new life, otherwise I was nearly going to get a new desktop because of shitty performance. In other words, it saved me ₹35000+ 😀

People on the IRC are very helpful to n00bs. One guy even killed his recovery pen drive to try out the earlier mentioned tar backup system, treating a USB disk as a tape drive.

Any amount of thanks won’t be enough to @freebsdhelp on Twitter, who guided me well whenever I got stuck.

Also, if you happen to plan one such installation, do follow this guide: A FreeBSD 9 Desktop How-to