FreeBSD Week: Migrating from Linux to FreeBSD

By now, anyone who is even remotely related to an IT-type position has heard about Linux, and has most likely used it, if only to see what all the hype is about. However, GNU/Linux is not the only “free” Unix type OS available. FreeBSD and its cousins, NetBSD and OpenBSD are all offshoots of BSD UNIX, a commercial UNIX also known as Berkeley Software Distribution. This article will help you learn more about FreeBSD, its differences from Linux, and it will ease a potential migration process.

Unlike Linux which uses the GPL license, the BSD family uses the BSD-style license. To summarize the differences between the two licenses in one sentence, the GPL requires any changes to the source code to be made public and be licensed under the GPL as well. The BSD license has no such requirement, any changes can be kept proprietary.


There are several major differences in the way FreeBSD and the major Linux distributions work. This article will step you through what I consider to be the biggest ‘gotchas’ that I encountered when switching my desktop from Linux to FreeBSD.


Although there are people who will argue this point, the term Linux refers to the kernel, nothing more. The applications that you use everyday on your Red Hat or Debian box are utilities added on by the respective distributions. FreeBSD on the other hand refers to the OS as a whole. FreeBSD is itself the kernel, as well as the basic applications needed to use a computer, such as the copy and move commands. This difference results in there being several distributions of Linux, such as Mandrake, SuSE, Debian and Slackware. Anyone who has used both Mandrake and Debian can tell you that there is a world of difference between them. There is only one FreeBSD. My FreeBSD is the same as the FreeBSD that you have — except for differences between versions FreeBSD is FreeBSD.


Three of the biggest Linux distributions, Red Hat, Mandrake, and SuSE use the RPM package manager. RPM handles installing, upgrading, uninstalling, and dependency checking for programs installed on those OSes. Although it does check for dependency errors before installing a program, RPM does leave a lot to be desired. For example, it cannot fetch other RPMs that are needed to solve the dependency errors. I know of are least 3 projects that solve this, urpmi, Debian’s apt-get which by the way isn’t remotely related to RPM and is a ‘Debian only’ feature, and a hybrid between RPM and apt-get. So unless you are willing to use one of the methods stated above, you have to manually find and download the required RPMs. Sound easy? Well it does until you try to manually install gnome or upgrade XFree from RPM’s. Even after you find the correct RPMs, if they are for SuSE and you’re running Red Hat, chances are they still might not work.


Each distribution of Linux is slightly different, and where they differ the most is in the file system layout. I’m sure that most everyone has heard about SuSE putting KDE in /opt while Red Hat puts in the /usr folder. To make matters even worse, RPM doesn’t recognize programs that are compiled from source. So if you have the latest and greatest Qt compiled from source, RPM doesn’t even know it exists if you try to install KDE from rpm’s.


FreeBSD uses what are known as “packages” to install, uninstall and upgrade applications. The ‘pkg_add’ command is used to install a package that you have manually downloaded to your computer. You can also run it with the ‘-r’ flag followed by a package name, and it will remotely fetch it from the Internet, as well as anything it requires to run. But the real beauty of FreeBSD’s packages is in the ports tree. The ports tree is simply that — a hierarchy of applications that have been ported to FreeBSD. Each directory contains a Makefile and any patches that are required for that particular app to compile and run on FreeBSD. For example, if I want to install the Apache web server, all I have to do is cd into the /usr/ports/www/apache directory, type ‘make && make install’, and go visit the snack machine. Assuming I have a fast computer with a decent Internet connection, when I get back it will have downloaded the apache source code, patched it, compiled it and installed it for me! The ports tree also handles any dependencies that Apache needs to run. It doesn’t matter if I’ve installed something via the ports tree, compiled it manually, on installed it via a binary package. The ports tree can find it as long as it is in your $PATH, and act accordingly.


Another difference between Linux and FreeBSD, is that with FreeBSD, 99% of what you install via ports or packages defaults into /usr/local, where as in Linux most of it goes into /usr, and sometimes /opt. This is for the most part a minor difference, however it is nice to know that whatever you have installed is in /usr/local and not spread all over the filesystem.

The FreeBSD system uses a program known as cvsup to keep itself up-to-date. Once you create a ‘sup-file’, cvsup compares what is locally on your system, and what is on the cvsup server and downloads any file that has changed since the last time it was run. You can use it to keep your ports tree and your local copy of the FreeBSD source code current and up-to-date. Unlike Linux, which normally only the kernel is downloaded and compiled on a semi-regularly basis, you can easily download the source for the entire OS using cvsup. The main reason for doing this is that it makes updating FreeBSD from one version to the next extraordinary simple. After cvsup’ing the newest source, you compile a new kernel, then you compile the ‘rest’ of the OS using one simple command: ‘make buildworld’. you then drop into single user mode and install it with ‘make installworld’. It’s just that easy.


The way that partitions are handled is also very different. Linux sees a hard drive as being divided up into different partitions. Of those partitions, some of them can have logical partitions inside of them. What we commonly think of as ‘partitions’, FreeBSD sees as slices. Within each slice are one or more ‘BSD partitions’. These BSD partitions are what shows up in the /etc/fstab.


Perhaps the next biggest difference between Linux and FreeBSD is the philosophy behind how the OSes are designed. Linux tends to have newer features and drivers (such as the closed source nVidia graphics card drivers) well before FreeBSD. The FreeBSD developers have taken a much more conservative approach to things. They prefer tried and tested code over flashy new features, preferring to wait until the major bugs have been worked out. For FreeBSD on the desktop this can be a problem if you want the latest and greatest drivers or the newest *cool* new feature. But in the server room, you want tried and tested code. Besides, how many of you put a $200 video card on your headless server?


Another difference is in what is installed by default. If you go with the default install options in SuSE, you’ll wind up with at least a gigabyte of installed software. FreeBSD on the other hand, installs just the basics. (Please note: I know that you can tell SuSE to only install the ‘basics’, but notice that I am talking about the ‘default’ install.) It gives you only the essentials, which you can use to install any of the 4000 applications in the ports tree. Almost all of the programs that run on Linux are already ported and running on FreeBSD, the only difference is that with Linux they are either installed by default, or unless you use Debian you have to go manually download them. With FreeBSD they are optional, and it is for the most part automated. Another difference in terms of what gets installed is that in Linux, the default shell is bash, however in FreeBSD it is tcsh.


For commercial programs such as Oracle or HP Openmail, FreeBSD offers a “Linux compatibility” layer. In simple terms this layer allows FreeBSD to run Linux binaries at almost native speed. Depending on the application it can run at full native speed under FreeBSD, just as it would under “Linux”. This compatibility layer is a step above emulation. The required Linux libraries are installed on the BSD system in binary form. When you try to run the Linux application, FreeBSD realizes that it is a Linux binary and simply points it to the Linux libraries that it depends on. There is also support for emulating commercial BSD, NetBSD, OpenBSD, and SCO binaries. Each respective OS is in different stages of support, with the best support for commercial BSD, NetBSD, and OpenBSD.


Although the BSD developers are more concerned with quality than quantity, that doesn’t mean that FreeBSD is lacking in features. FreeBSD 5.0, due in Novemeber of 2002 will feature fine grained process control, which will enable it to scale effectively up to 32 processors. Version 5.0 will also feature a full DEVDFS device filesystem. Although this has been available in Linux for quite a while, you don’t hear much about it. It basically allows for the dev file system to be dynamically changed. For example, if you add a USB keyboard, it would ‘magically’ be added to the /dev directory. As for journaling file systems, the stable version, 4.4 has a feature known as ‘soft updates’. While it is technically not a journaled file system, depending on who you ask it is better than a journaled filesystem.


Throughout the big dotcom boom of ’98-’99 Linux was THE buzzword. Computer users everywhere were hearing about a *free* operating system that was challenging Microsoft in the server room as well as the desktop. Even today, the userbase of Linux is growing strongly. However most people are just beginning to hear about FreeBSD. Hopefully this article will help you evaluate FreeBSD as a possible solution to your needs. In the end though they are both free, so why not try them both and pick the one that best suits your needs?


About the Author:
Nathan Mace is currently a senior enrolled at the University of Charleston, West Virginia, majoring in Computer Information Systems. He is interested in all types of operating systems, expecially Unix-type OSes such as Linux, *BSD’s, and commercial Unices. Nathan can be reached at [email protected]


Related Stories:

  • Introduction to FreeBSD

  • The Big *BSD Interview

  • Book Review of “FreeBSD Unleashed”

  • Interview with Robert Watson of the TrustedBSD project

  • FreeBSD as a Workstation for UNIX Newbies
  • 58 Comments

    1. 2002-01-31 8:38 pm
    2. 2002-01-31 8:42 pm
    3. 2002-01-31 8:55 pm
    4. 2002-01-31 9:02 pm
    5. 2002-01-31 9:08 pm
    6. 2002-01-31 9:40 pm
    7. 2002-01-31 9:43 pm
    8. 2002-01-31 9:44 pm
    9. 2002-01-31 9:57 pm
    10. 2002-01-31 10:01 pm
    11. 2002-01-31 10:04 pm
    12. 2002-01-31 10:40 pm
    13. 2002-02-01 12:00 am
    14. 2002-02-01 12:17 am
    15. 2002-02-01 12:18 am
    16. 2002-02-01 1:26 am
    17. 2002-02-01 1:52 am
    18. 2002-02-01 2:30 am
    19. 2002-02-01 3:07 am
    20. 2002-02-01 3:24 am
    21. 2002-02-01 4:04 am
    22. 2002-02-01 4:15 am
    23. 2002-02-01 5:05 am
    24. 2002-02-01 5:23 am
    25. 2002-02-01 5:42 am
    26. 2002-02-01 5:50 am
    27. 2002-02-01 6:11 am
    28. 2002-02-01 6:19 am
    29. 2002-02-01 10:54 am
    30. 2002-02-01 12:16 pm
    31. 2002-02-01 2:48 pm
    32. 2002-02-01 3:08 pm
    33. 2002-02-01 3:41 pm
  • 2002-02-01 6:09 pm
  • 2002-02-01 7:49 pm
  • 2002-02-01 7:53 pm
  • 2002-02-01 10:46 pm
  • 2002-02-01 10:47 pm
  • 2002-02-02 7:20 am
  • 2002-02-02 11:38 am
  • 2002-02-02 1:05 pm
  • 2002-02-02 10:30 pm
  • 2002-02-03 5:53 am
  • 2002-02-04 12:44 pm
  • 2002-02-05 9:17 pm
  • 2002-02-05 9:40 pm
  • 2002-02-06 5:29 am
  • 2002-02-09 7:01 pm
  • 2002-02-10 1:45 am
  • 2002-02-14 11:29 am
  • 2002-02-14 11:35 am
  • 2002-02-19 7:08 am
  • 2002-02-19 10:46 am
  • 2002-02-21 7:02 pm
  • 2002-02-27 11:50 pm
  • 2002-02-28 5:42 am
  • 2002-02-28 5:58 pm
  • 2002-03-22 5:46 am