DragonFly BSD 2.6: towards a free clustering operating system [LWN.net]
LWN.net needs you!Without subscribers, LWN would simply not exist. Please consider signing up for a subscription and helping to keep LWN publishing.
There aren't many BSDs compared to Linux distributions: most people only know FreeBSD, OpenBSD, and NetBSD. Of course there are more than just the "big three" BSD operating systems, but most of them are marginally used or (in the case of Mac OS X) proprietary. However, two operating systems are becoming more and more popular in the BSD world: one is PC-BSD, a KDE-based FreeBSD derivative that strives to be the Ubuntu of the BSDs, and the other is DragonFly BSD, a FreeBSD fork that aims to provide single-system image clustering in the long term.
In 2003, FreeBSD developer Matthew Dillon created DragonFly BSD as a fork of FreeBSD 4.8. He did this because he didn't agree with the direction FreeBSD 5 was going in the domains of threading and symmetric multiprocessing. Since then, the DragonFly BSD kernel diverged significantly from its mother kernel, for example by adding a Light Weight Kernel Threads (LWKT) implementation and a virtual kernel similar to User Mode Linux. However, there is still a close collaboration between DragonFly BSD and FreeBSD, and FreeBSD device drivers are regularly imported into DragonFly BSD. The operating system has also ported some functionality from NetBSD and OpenBSD.
The ultimate goal of DragonFly BSD is to allow programs to run across multiple machines as if they are running on one system. The operating system is still far from that goal, but Dillon has done a great deal of rewriting in nearly every subsystem of the kernel to lay the foundations for future work. Much of the rationale behind the design goals is explained on the project's web site. It's an interesting read, because it shows how they want to tackle an ambitious vision with a realistic plan:
First and foremost among all of our goals is a desire to be able to implement them in small bite-sized chunks, while at the same time maintaining good stability for the system as a whole.
HAMMER time
After some preliminary work in version 1.12, DragonFly BSD added a new clustering filesystem in version 2.0, which was finally considered production-ready in version 2.2: HAMMER. There are also ports of the filesystem to Linux and Mac OS X, both using FUSE. HAMMER is a modern filesystem with fine-grained snapshots, integrity checking, instant crash recovery, and networked mirroring. It's no coincidence that this sounds a lot like ZFS: Dillon investigated ZFS and for a while it looked like he would port it to DragonFly BSD, but in the end he wasn't satisfied with the design and wrote his own, more cluster-oriented filesystem. The main reason for this was simple: DragonFly BSD's goal is transparent clustering, which needs a multi-master replicated environment. In this type of environment, ZFS doesn't quite fit the bill, as Dillon explained on the DragonFly kernel mailing list:
The problem ZFS has is that it is TOO redundant. You just don't need that scale of redundancy if you intend to operate in a multi-master replicated environment because you not only have wholely independant (logical) copies of the filesystem, they can also all be live and online at the same time.
HAMMER's approach to redundancy is logical replication of the entire filesystem. That is, wholely independant copies operating on different machines in different locations.
HAMMER is the default filesystem now, but it's not recommended for storage media smaller than 50 G; DragonFly BSD uses UFS for small media. HAMMER supports filesystems up to 1 exabyte. Each HAMMER filesystem can span up to 256 disks, which can be added to an existing filesystem to let it grow. Users don't need to manually take snapshots: the system automatically writes historical data during each filesystem sync, which is every 30 to 60 seconds. Prior versions of files and directories are then accessible by appending @@ and a 64-bit hexadecimal transaction ID to the file name. In this way, users can even cd into a prior version of a directory. The system administrator can choose a history retention policy to prevent the filesystem from filling up too quickly, and explicit snapshots can also be made. Although HAMMER is considered production-ready by its developers, it's still a relatively young filesystem with the occasional serious bug. For example, soon after the 2.6 release a serious HAMMER corruption issue came up.
New features
New releases of the operating system occur approximately twice a year. The latest release is DragonFly BSD 2.6.1. Three of the most interesting new features are swapcache, tmpfs, and POSIX message queues. The former is a mechanism that allows the operating system to use a fast SSD to cache data and/or metadata for hard drive filesystems, which should improve disk performance dramatically. Swapcache works on all filesystems (e.g. HAMMER, UFS, or NFS) and is a simple turn-on-and-forget type of feature. The man page of swapcache has an extensive description of the new functionality and adds an analysis with some real-life examples.
The memory filesystem tmpfs is a port from NetBSD. After loading the tmpfs driver as a kernel module at boot time, the user can create tmpfs filesystems. The data is backed by swap space when there's not enough free memory, but the metadata is stored in kernel memory. The tmpfs man page recommends that a modern DragonFly BSD platform reserve a large amount of swap space to accommodate tmpfs and other subsystems. The DragonFly BSD developers also ported the POSIX message queues API from NetBSD 5, which allows processes to exchange data in the form of messages.
Live CD
DragonFly BSD is distributed as a live CD ISO or USB image that lets users check their system for hardware compatibility before installation. For now, there are only versions for i386 and x86_64 architectures. The web site also talks about a DVD ISO that is able to show a full live X environment, but in the 2.6 release this has been replaced by a GUI USB image that boots into the desktop. At the time of this writing, the GUI USB image was not available yet due to some problems.
DragonFly BSD uses BSD Installer, a console based system installation and configuration tool that is more user-friendly than FreeBSD's sysinstall. BSD Installer started its life as DragonFly BSD's installer, but it has since been ported to FreeSBIE and pfSense. The installation is straightforward, although for non-US users it's slightly annoying that the choice of keyboard layout is presented only after choosing the root password and adding a user. After installation and configuration, the system reboots into a minimal console-based BSD system.
Instead of FreeBSD ports, DragonFly BSD uses NetBSD's pkgsrc as its official package management system. This freed the DragonFly BSD developers from having to maintain a large number of third-party software, and pkgsrc is designed with portability in mind. Users can install over 9000 binary packages in DragonFly BSD (with the pkg_radd command) or build them from source. For users that want to run software that exists for Linux but not for BSD, DragonFly BSD has a Linux emulation layer: the Linuxulator in the 2.6 release even runs Java and Flash, at least on the i386 architecture.
Documentation
The project's web site has a lot of documentation, both for users and developers, including some specific howtos. There's also an extensive but slightly out-of-date handbook based on the FreeBSD handbook, and a less extensive but more up-to-date new handbook. The handbook guides the user through the installation, but it also has chapters about "UNIX Basics" (which is a mix of DragonFly BSD basics and general UNIX basics), the pkgsrc packaging system, configuring X, and more advanced topics like jails, security, the kernel, and virtual kernels.
Readers that want to keep an eye on the project but don't have the time to read the mailing lists can read The DragonFly BSD Digest by Justin Sherrill. Some Gource visualizations of the DragonFly BSD development nicely show what the small but active group of developers is doing. We looked at Gource and other visualization programs earlier this month.
Conclusion
For a relatively small (45 committers) and lesser-known BSD operating system, DragonFly BSD is surprisingly good and development of new features happens remarkably fast. Maybe this small scale is the reason why the project is so innovative. The fact that the BSD Certification Group has added knowledge about the operating system to the requirements of the BSD Associate certification is another sign that DragonFly BSD is here to stay. But ultimately, the road to its goal is still paved with a lot of work.
Index entries for this article | |
---|---|
GuestArticles | Vervloesem, Koen |