The big FreeBSD server upgrade


The past few days, I’ve been upgrading my FreeBSD server with the help of a friend of mine. Let’s take a trip down memory lane in order to explain this upgrade.

In the mid-90s, I think it was in my second year in university, some friends and fellow-students came together and had this idea of running their own server for various tasks. If we were to place a server in a dorm, we had a direct 10 mbit link to the internet. Blazing speeds back in those days (and even today, 10 mbit uplink is nothing to scoff at). So one guy donated an old Pentium 75, and we all chipped in to buy a new harddisk, where everyone would get their share of the total disk space.

Initially we installed Slackware Linux on it. It ran okay for a few months, but at some point, there was data corruption… The drive was literally beyond repair, because fsck itself would crash when you tried to fix it. So we had no other choice than to reinstall the whole system from scratch. Since we didn’t know exactly what caused it, and it turned out that the harddisk itself was fine, so it must have been a software-related issue, we were a bit wary of reinstalling Slackware.

Then a friend recommended us to try FreeBSD instead of Linux. Long story short: we never looked back. As far as servers go, FreeBSD worked just as well as Linux did. It supported all the hardware we needed, and FreeBSD never gave any data corruption problems or anything. It ran fine for years on end. We also really liked the Ports system of downloading and building applications from source, before installing them. Back then, Gentoo Linux didn’t even exist (Portage being much the same as FreeBSD’s Ports). There were also other advantages to FreeBSD, such as there being only a single distribution, and only a single organization that maintains FreeBSD and its Ports. You always know where to get your software, updates, documentation, news etc. It’s all centralized. There’s no ‘distro-wars’. And, in my opinion the FreeBSD kernel was also a more mature design than the Linux one. FreeBSD focused on loadable kernel modules at a much earlier stage than Linux did, and also things like efficient locking of resources and thread scheduling were more advanced in FreeBSD. As a result, FreeBSD ran very nicely even on a modest Pentium 75, it was lean-and-mean.

Anyway, when I got broadband at home, initially I just had the modem connected to my own Windows PC, and shared it over our home network from there. The downside was ofcourse that the internet only worked when my PC was on. And I at least turned my PC off at night, as it was in my bedroom, so the internet wasn’t exactly always-on. Because of my experiences with the Linux/FreeBSD system, I figured that I could set up an old PC at home, have it always-on, and use it as a gateway for internet, so the rest of the house was no longer dependent on my PC. It would also allow me to run my own services such as FTP, HTTP and SSH, which can be useful from time to time, when I want to transfer files from home to university or back.

The hardware

So I grabbed an old 486 that my dad brought home from work one day. I bought a cheap second network card, so it could be a bridge between the LAN and the ADSL modem (back then ADSL modems didn’t always have NAT/routers/switches or even firewalls built in, so for security’s sake it was best to have the modem on a physically different network from the rest of the house). Then I set up FreeBSD on it, and configured it as a gateway.

After a while we discovered that you could get free subdomains from, so I registered, which I still use as my own domain. I’ve been using it ever since. That’s pretty much the idea behind my home server, I do everything for free… Surplus hardware, free software, and free services. I used it to host my own web page, forum, mail, ftp, and I could SSH to it for things like IRC, ICQ, MSN, without having to install software elsewhere (aside from an SSH client if it wasn’t already available… but something like Putty didn’t really need to be installed anyway).

Ofcourse, these old systems don’t last forever. Even FreeBSD gets more bloated at every release, and compiling software can be a real drag on a slow system. So from time to time, I’ve upgraded the hardware, mostly with other surplus stuff. I’ll just give a short overview of the systems I’ve used over the years, the Generations Of so to speak:

  1. (around 1999?) Compaq Deskpro system with 486DX2-66 processor and 16 MB memory. 4 GB Quantum Bigfoot HDD and 540 MB IBM SCSI disk.
  2. Replaced the 486DX2-66 with a Pentium 83 MHz OverDrive that I found at Crazy Hans. Greatly improved compiler performance, and it actually was quite close to the performance of the real Pentium 75 in the other system.
  3. (around 2002) Homemade Pentium 150 with 64 mb memory, using a 20 GB Maxtor HDD. I had to upgrade to the Pentium 150 because the Bigfoot was dying, and the older machine just couldn’t handle larger disks, and it was virtually impossible to get a disk smaller than the ~8 GB that it did handle, they didn’t sell anything smaller than 20 GB anymore. I had a Deskpro identical to the 486, but with a Pentium Pro 200 processor board instead. Sadly I couldn’t use that one either, as it had the same problem of not being able to boot with a large drive attached. And since it was a custom Compaq bios, the available bios patch workarounds didn’t work either (I used one on the Pentium 150 actually).
  4. (around 2007) Homemade Pentium II 350 (actually a 333 overclocked to 350 to make use of the 100 MHz FSB) with 320 mb memory, using a 40 GB Maxtor HDD. Again this was pretty much a forced upgrade. The PSU in the Pentium 150 had died, and although I had replaced it with another PSU, it was the last AT PSU that I had (the Pentium was pre-ATX form factor). I didn’t know how much longer it would last. Aside from that, I had the PII to spare anyway, and I could do with something that was faster and had more memory.

And that brings us to where we are today. The Pentium II also burnt through a PSU. The fan got stuck because of all the dust… That wasn’t a problem per se, since the Pentium II ran really cool, and didn’t really require fans. So while I knew that the fan was no longer spinning, I just left it running like that. However, the PSU itself eventually overheated, and I think the overheating had also damaged the harddisk. After I replaced the PSU with a new one, the system worked again, but the disk made a pretty nasty whining noise. I suppose the bearings are worn out. Since I didn’t know how much longer it would last, I had to prepare a new upgrade again.

While I do have more surplus machines around, they are both Athlons, and of the high-end variety. One is a Thunderbird 1400, the other an Athlon XP1800+. I was reluctant to use them as a 24/7 server. Firstly, because I have a history of going through power supplies and fans, and having overheating problems… with these systems it would be far worse. Secondly, these CPUs are VERY powerhungry (around 70W for just the CPU), and have virtually no power saving options. So they’d be eating a lot of power all the time, just converting it to heat, while just sitting idle most of the time.

Instead, I started looking at options for a new system. Originally I wanted an Atom, but the problem is that they are generally small form factor, and not really aimed at server tasks. I would want to fit a regular 3.5” harddisk and all that. The larger systems also came with pretty hefty pricetages. However, I found that Socket 775 barebones could be had pretty cheaply, and you could put a 45 nm Core2 processor in them. Those are very fast and also consume very little power. Not as low as an Atom perhaps, but good enough, probably less than any of the systems I’ve had so far, and they’d deliver far more performance than an Atom.

So I got an Asus V3-P5G31 barebone, and I put a Pentium DualCore E5200 in there (2.5 GHz). I still had some 1 GB DDR2 memory left from an upgrade to my desktop system, so I didn’t have to buy any memory. I also had a 120 GB Seagate harddisk, so I didn’t have to buy that either. In the end, the system cost me less than 150 euros, and funny enough the E5200 is about as fast as the Core2 Duo E6600 (2.4 GHz) in my main system, which I bought about 3 years ago, for 306 euros (the CPU only, now I have a complete computer for half).

The software

So much for the hardware… Now let’s discuss the software. Since this is a 64-bit CPU, I decided to try the AMD64 release of FreeBSD 7.2 on it. It detected all my hardware out-of-the-box, and installed and booted just fine. I also had no problem installing all the applications I need. Everything seems to be ported nicely and it works just as well as the 32-bit stuff so far.

Then the next step was to migrate all the data and configuration from the old system. I decided that I wanted to be up-to-date with everything, so some things required upgrading. I also wanted to clean up some configurations, because over the years, some things had become a mess. Some things could also use some improvements. This is where I called in the help of my friend. A daunting task to do by yourself. Two people know more than one.

I started by preparing a ‘script’ of the actions we wanted to take. He proposed to use SVN to store the configuration scripts. That was an excellent idea. Not only would you have a backup, but you’d actually be able to go back in history, and have a changelog at hand. We started off by just putting the default configuration into an SVN, and then modifying or replacing the scripts with parts of the old system, and checking in the changes regularly. I can recommend that to anyone.

For the most part, I have always kept the software up to date reasonably well, not just in terms of patches and bugfixes, but when a new generation was available alongside the current one, I would generally adopt it at a relatively early stage (eg Apache 1.3 vs Apache 2.0, or PHP 4 vs PHP 5). So a lot of things could be transferred to the new system quite easily. There were only three upgrades that had to be carried out, namely mysql 4.1 to mysql 5.0, phpBB2 to phpBB3, and egroupware 1.2 to egroupware 1.6.

Mysql went quite smoothly actually, just dumping the database from one system and importing it into the other was pretty much enough. Aside from that, a script had to be run to update the user permission tables, and that was pretty much that.

With the database in place, phpBB could be upgraded. This also turned out to be relatively simple, as there was an upgrade script included in the phpBB3 installation. All you had to do was to install phpBB3 alongside phpBB2, do a basic setup of phpBB3, and once the forum was setup, you could run the upgrade script which would automatically import all the data from the phpBB2 instance. The upgrade script did exactly what it said on the tin, so this too was an easy ride.

With egroupware there were some snags… I installed egroupware 1.6, and tried to upgrade the existing 1.2 database to 1.6. It *appeared* to work at first, the login screen came up, and after you logged in, you got to your main screen, and everything looked okay. However, when you wanted to use any of the applications, some errors appeared. Then when you went back, even more errors appeared… and then so many errors that the pages didn’t load at all anymore. Obviously I thought that something had gone wrong during the upgrade, so I started checking the configuration. I couldn’t find anything strange. Then I tried installing the latest version (ports had 1.6.001, while 1.6.002 was also available), restored the old table and did the upgrade again. Still the exact same problems. Then I figured I’ll try it without an upgrade, just creating a new database from scratch… And yet again, the exact same errors.

Since the errors had something to do with mysql (complained about “Couldn’t fetch mysqli” in some mysql_real_escape_string() function call), I figured that perhaps the code had some issues running on mysql 5.0. But that was a tad unlikely, as the database access was fine during the configuration/setup stage of egroupware. Since phpBB and phpMyAdmin also worked fine on the mysql server, I figured the configuration of Apache, PHP and mysql were all okay. I also checked the older installation, and it also used the mysqli database connection, so that couldn’t have been the problem either.

So well, at this point I couldn’t really be bothered to solve the issue. It seems like something is broken in some of the egroupware code. I decided to just copy the old version from the other server, and see if that would run on the new database, and if that didn’t work, I would try to upgrade the old server to mysql 5.0 to see if that would break it. And indeed, the old version ran just fine on the new system… So that’s what I stuck with so far. I’ll look into the problem again at some other time.

Anyway, while we were at it, we also wanted to improve the security somewhat. I had wanted to use SSL on Apache and IMAP, but I never figured out how to do that. We now have SSL running, so we moved egroupware and phpMyAdmin behind https. So all the traffic is encrypted now, nobody can eavesdrop anymore. The same goes for IMAP, this now accepts only SSL connections, so even if I access my mail remotely, there will be no eavesdropping. Should have sorted that out long ago, but you know how those things go 🙂

Toying around

I already had the machine for a while, before finally taking the time to do the migration… I had installed FreeBSD right away, and figured it would be fun to toy around a bit, now that I have a pretty powerful system, with plenty of memory. The Pentium II with 320 mb memory was also quite an improvement over the older systems with 64 mb, so I had already played around a bit with KDE and remote X sessions, but it wasn’t that successful. But on this machine it actually works pretty well. I’ve also installed Java and Netbeans, and used it for some C/C++ development (did some testing, debugging and bugfixing on CPUInfo). In fact, I’m currently playing with Xming on my Windows PC, running KDE4 remotely. Still seems to have some glitches, but it might be useful once I iron those out.

I did actually manage to run Croissant 9 by Bohemiq on FreeBSD, and it ran pretty smoothly. At any rate, this is by far the biggest upgrade I’ve done to my home server, both in terms of hardware and in terms of software. I think I’ll be enjoying this machine for many years to come.

This entry was posted in Uncategorized. Bookmark the permalink.

5 Responses to The big FreeBSD server upgrade

  1. Pingback: Phoronix: FreeBSD: A Faster Platform For Linux Gaming Than Linux? | Scali's blog

  2. Snake says:

    Hello Scali, nice post 🙂
    I was wondering if you could answer me a little question: I was involved using FreeBSD long time ago (>8 years) for a while, just for some server purposes (so no XFree or DM), and then never again, until today.
    I began recently to take a look around the FreeBSD world as a robust and lighter alternative to a Linux distribution for a small Intel Atom nettop I should overhaul soon.

    Could you suggest me some kind of FreeBSD “user friendly” _distribution_ (dunno if the word “distribution” is proper in the FreeBSD world), mainly for a desktop usage? I’ve seen inside the Phoronix article that they’ve used the PC-BSD, which looks very nice for this task (it has KDE4 and other stuffs prepackaged), so I suppose it should be easier to set it up compared to the official FreeBSD release, considering that my knowledge of FreeBSD is, at the moment, very rugged and weak.

    What do you think? Do you have any suggestions?

    Thank you very much 🙂

    • Scali says:

      Well, I don’t know really. Distributions aren’t really FreeBSD’s thing, which I actually think is a good thing. Since FreeBSD is a complete OS, rather than just a kernel, things are more centralized and consistent than with linux distributions.
      There are a handful of distributions based on FreeBSD, but I haven’t used them myself. I only know of PC-BSD and DragonFly BSD.

      I suppose PC-BSD is nice for people new to FreeBSD, as it will give them a relatively simple and userfriendly way to try out the OS. More or less like what Ubuntu is in the linux world. But it is mainly aimed at desktop usage, I suppose. I only use FreeBSD as a server, and the standard FreeBSD release works fine for me, so I’ve never used PC-BSD.
      I do install Xorg on it, and Gnome, but I don’t use it often, and it is only started up for a session every now and then. It is not kept running.
      So, well it’s not entirely impossible to use FreeBSD for a desktop system, but it will probably be a bit harder to set up than PC-BSD (then again, once you’ve got the base install of FreeBSD running, it’s not that difficult to install KDE or Gnome through the package system, or even building it through ports). So I think you should test the waters with PC-BSD first. Or alternatively, set up a virtual machine and try to install FreeBSD there. With the help of the FreeBSD handbook you should be able to get it running.

  3. Pingback: Why I don’t use linux (and why you shouldn’t either) | Scali's blog

  4. Pingback: Another FreeBSD server upgrade… | Scali's OpenBlog™

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s