Slashdot Mirror


User Mode Linux

Ravi writes "There is commercial grade software like VMware (which does full virtualization) as opposed to open source approaches like Xen which do partial virtualization. But besides these two, there is a very interesting piece of software called User Mode Linux (UML), which can be used to create virtual Linux machines within a Linux computer. Unique to UML is that support for it has been incorporated into the mainstream Linux kernel tree and it is now a fully supported part of the official Linux kernel. On this note, UML gains a lot of significance. UML has been created and maintained by Jeff Dike, who is known throughout the Linux technical community. And when someone who has created a popular software decides to author a book on the subject, then that book is sure to hold a lot of promise. So when I came across the book titled User Mode Linux, authored by Dike under Bruce Perens' Open Source Series, I just couldn't resist getting my hands on it." Read on for the rest of Ravi's review. User Mode Linux author Jeff Dike pages 330 publisher Prentice Hall rating 9 reviewer Ravi ISBN 0131865056 summary Guidance from UML's creator on setting up and putting to work your own instances of User Mode Linux virtual machines.

In the first chapter, Dike compares UML and various other virtualization technologies, lists several ways in which UML can be put to use, and provides a brief history of UML in which he shares with the reader the trials and tribulations he faced in getting the UML patch incorporated in the official Linux kernel tree.

In the next chapter, "A quick look at UML," Dike walks the reader through setting up UML to work in one's Linux distribution, which includes downloading the UML-enabled Linux kernel binary and the file system, and then booting into UML. Here we get a taste of the utilities which are used to modify in real time the configuration parameters of UML from the host OS. This chapter gives a sound introduction to what goes on behind the booting of UML and how it differs from the host OS in which it is running. For instance, the author aptly explains with the aid of examples that UML is at the same time a process and a kernel.

Chapter 3, "Exploring UML," dissects a UML instance in more detail. Here the author explains how one can connect devices to the running UML instance using the uml_mconsole utility. Common tasks like adding swap space, attaching and detaching devices as well as setting up networking are essentially the same in UML as in any normal Linux distribution, there are a couple of extra steps needed in setting these up in a UML instance. This chapter gives a taste of accomplishing these tasks.

But is it possible to access the same UML file system simultaneously by different users? Normally, this could corrupt the file system. So what is the workaround? The solution is in the use of COW ("Copy on write") files. Dike shows how multiple users can access the same UML instance (each user having full root access) without corrupting the underlying file system using COW files. And this forms the basis for the 4th chapter of this book, "A second UML instance." In this chapter, one also gets a peep into setting up networking between two UML instances but all the advanced networking concepts are explained in a separate chapter of their own.

The next chapter, "Playing with a UML Instance," takes the reader through a variety of things one can do with UML. For example, the author shows how one can just plug in a tar file to a block device and then access it in the UML instance. He also demonstrates how to run X inside UML.

Next, the book goes into a detailed analysis of the various file systems that could be used in UML. Here the author explains the various ways of mounting a directory on the host as a UML directory. In fact you can easily mount your home directory into a UML instance and access your files from inside the UML.

One cannot enable networking in UML quite the same way as in a normal Linux distribution. This is because the UML runs as a process within another Linux distribution. So for networking to work properly between the UML instance and the host system or between different UML instances, a device called TUN/TAP has to be configured first. Also one has to configure the host system to allow the UML instance access to the outside world; this could include tasks like enabling IP forwarding, routing packets to and from the UML, and bridging the host side of the virtual interface to the physical ethernet device. Chapter 7, "UML Networking in Depth," takes a broad look into these networking aspects of UML. I especially liked this chapter because this opens up avenues for people who are interested in learning more about networking. For example, following what has been covered in this chapter, one can -- given enough memory -- set up a network lab on one's machine consisting of a series of UML virtual machines and practice things like switching and bridging. At the end of this chapter, the author gives a step-by-step explanation of setting up a multicast network consisting of three UMLs and three two-node networks, and another UML acting as a switch.

In running UML virtual machines on a host system, at some point of time, it becomes inevitable that one has to manage these virtual systems from within the host. Tasks such as increasing or decreasing the memory allocation to a particular UML instance, hot-plugging a block device, starting or stopping the UML, and so on will have to be carried out on a regular basis especially if the host is a production system. One can install the uml utilities package on one's Linux server to take care of all these tasks from outside the UML. Chapter 8, "Managing UML Instances from the Host," takes a broad look at just that. This chapter covers configuring the different aspects of UML using the UML management console.

The next two chapters cover the nitty-gritty details of configuring UML in a small and large server setup, respectively. When UML is run in production environments, the security of the system takes precedence, and these chapters focus not just on the configuration details, but also on explaining how to run UML securely.

A look around the web will throw up lots of UML file systems and UML-enabled Linux kernels. But the best way (also the most secure way) of getting a UML kernel is to download the official Linux kernel source and compile it yourself. Chapter 11, "Compiling UML from Source," takes a detailed look at compiling the official Linux kernel from source. Here the author explains each and every UML specific option which could be enabled in the configuration file of the kernel prior to compiling it.

In "Specialized UML configurations," Dike demonstrates how to set up a small UML cluster using Oracle's ocfs2. The interesting thing is that the shared storage device which is common for all clusters and which consists of expensive hardware is just a file when implementing a UML cluster. Through this chapter, the author displays the true power of UML and explains how a UML could be used in stimulating hardware which is difficult or expensive to acquire.

The last chapter of the book gives a road map of UML and lists the enhancements that might take place in UML in the future. More specifically, he talks about the externfs filesystem, whose purpose is to allow any reasonable external data to be imported as a UML filesystem, about captive UML, putting a UML instance inside Apache, and so on.

The book also contain two short appendices which list the command line options while booting a UML instance, as well as a short reference on the UML utilities which could make it easier to manage the UML instances on ones machine.

With the continuing increase in processor speeds and availability of cheap memory, it has become feasible to use virtualization technology in production machines. UML can be put to use in diverse situations such as server consolidation where multiple UML instances running on a single machine accomplish the tasks of multiple physical server machines; in education, where each student can be assigned a complete virtual Linux lab setup with root access; in application development; and in disaster recovery practice.

User Mode Linux is a result-oriented book with stress given to accomplishing tasks rather than concentrating on theory alone. That said, this book has enough details to give a broad idea about UML and its implementation. That it was written by Jeff Dike gives this book a lot of credibility over books written on the same subject by others. UML being a niche area, anyone who is interested in this subject will gain a lot from this book.

Ravi Kumar is passionate about GNU/Linux. And likes to share his thoughts through his blog on GNU/Linux. You can purchase User Mode Linux from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

6 of 77 comments (clear)

  1. UML? by cpux · · Score: 1, Informative

    You mean that Unified Modeling Language I spent a semester learning and to this day can't stand cause the professor was a knucklehead?

  2. [OT] Re:Why constant patronage of Bn.com? by Anonymous Coward · · Score: 0, Informative

    Maybe they aren't fans of Amazon's one-click patent.

  3. Re:UML != User Mode Linux by Homology · · Score: 1, Informative
    UML = "Unified Modeling Language" - let's not add a new meaning to this acronym as it's sure to be confusing when someone starts talking about reading and writing UML on their UML workstation.

    The world is filled with short lived acronyms that should is only understandable in it's context. However, UML = "Unified Modeling Language" is just hubris produced by a company that demands a shitload of money for a shitty process.

  4. Re:The Big Secret of User Mode Linux by nicferrier · · Score: 4, Informative

    the very latest UML (in kernel 2.6.17?) does have support for NPTL.

    Having said that I have succesfully run Sun and GNU Java in the 2.6.15 UML and 2.6.8 UML neither of which support NPTL. It's just like the old days, you end up with a lot of processes. It's ok for simulating environments though.

  5. Re:The Big Secret of User Mode Linux by rimu+guy · · Score: 3, Informative

    UML Works great with Java apps. We've been hosting Java user's on UML VPSs since 2003 (latterly we are using Xen).

    The version of UML we are using does not have NPTL (/lib/tls) support. This is probably what you're referring to. I've seen patches for NPTL support, so this is either fully supported now or 'on its way'.

    --
    Great Java Hosting (with or without /lib/tls)

  6. Re:QEMU ? by psmears · · Score: 3, Informative

    From the site you linked to:

    The QEMU Accelerator is free to use, but it is a closed source proprietary product.

    ... so perhaps not the best example of an open source virtualisation app. (The QEMU accelerator is needed to true virtualisation like the other examples being discussed—without that, QEMU is just a processor simulator, and so runs 5–10 times slower—at least, according to its own web page!)

    [OT: Apologies for the boldface—the new style doesn’t allow italics inside <blockquote>—WTF?]