Xen - Re State of accessibility on BSD systems

luke speakup at lists.tacticus.com
Thu Sep 25 04:03:00 EDT 2008

On Wed, 24 Sep 2008, Tony Baechler wrote:

> Sorry to overquote here, but I'm confused by your message.  I do understand
> what virtualization is, but I wasn't 100% sure that Xen is in fact a
> virtualization product.

It is.

> It looked like it requires special kernels with Xen
> patches, but the manual says it runs Windows XP.

It requires OS modifications, and thus the patched kernels.  I know that 
people have caused it to run XP.  I have never had reason to try that, 
however, nor have I had any reason to investigate it, so I have no idea 
how to do that, or how well it works.

> I know what loop files are,
> but what is LVM or LVM2?  I know it stands for logical volume management, but
> how does that have to do with this?  Other than knowing what LVM stands for, I
> have no clue what it does or why one would want it.

Logical Volume Manager, I believe.

Its value is that it removes the major necessity to partition in advance.

I'll give you a bit of an example.

I built a server, with a set of 300 gig drives.
The first partition on each, was a RAID1 volume of about 256 MB, for 
The second on each was a RAID1 volume of about 50GB.

In that 50 gig partition, I created 3 logical volumes, using LVM.
The first was 4 gig.  I put an EXT3 file system on that, and mounted it on 
/ (I.E. the root dir).
The second was 4 gig, which I allocated to /home.
The third was all of the remaining space, which I mounted under /var.

I shouldn't ever have to change those, but let's just say that for some 
reason, I one day decide that I need ten gig under /home instead of four.  
How can I get it without installing another drive with ten gig on it, and 
making a new partition formatted with EXT3, and remounting /var on it?
and, if I were to do that, I have just wasted four gig on the original 

Well, with LVM, what I can do, is find a block of six gig somewhere, and 
tell LVM that said block of six gig, is a physical volume, in the same 
volume group as the existing /home partition.  I can then expand the 
logical volume underlying /home, to fill that additional six gig, and then 
expand the EXT3 partition into the new space.

Without wasting any space, and without moving my current /var files, I 
have made that partition span two disks in a completely transparent way, 
and increased the size of the partition.

That is a simple example, and in practice I probably wouldn't do something 
quite like that.  That is a sort of JBOD system, if you understand RAID.

Now, on that same server, I have this setup.

In addition to a volume group for swap partitions, I have a huge chunk of 
space, allocated to a volume group for Xen virtual machines.

Let's say that I want to create a virtual mail server.

I might decide that I want that mail server to have a 1 gig partition for 
system data, and a 5 gig partition to store mail on.

If I was using fdisk and real partitions, I could probably create those, 
although I would eventually run out of partitions.  Additionally, when I 
deleted one which was between others which I was not deleting, I could 
not reclaim that space except with a smaller or equally sized partition, 
and I would have to calculate that every time, and keep track of where 
the blank spots were on the drive.

With LVM: no problem.

I tell LVM to make me a 1 gig partition, and a 5 gig partition.
I don't care where it puts them, as long as they are in the right volume 
group, which may consist of a single drive with a single partition, or 
multiple drives, growing to arbitrary size.

It creates them, and I tell Xen that these are the available partitions to 
build the virtual machine on.

I format those partitions with ext3 or what ever, and then mount the 1 gig 
partition under /mnt or something, copy a basic Debian (Ubuntu, actually) 
system on to it, tweak a few files (fstab, hosts, network/interfaces, and 
maybe a few others), unmount it, and I am ready to boot the new virtual 
mail server.

Oh, I also create a swap partition of what ever size I think is 
reasonable.  If I have granted the virtual mail server a memory chunk of 
256 MB of physical RAM, then I might give it a 768 MB swap partition, 
which I would include in the list of partitions which Xen would give to 
the virtual, and I would list it in the virtual's fstab.

 If I screw up, I can do anything up to and including blowing away those 
logical volumes.

In short, if you do a lot with virtual machines, and don't have a fixed 
number of them, or periodically build and destroy virtuals, I think LVM is 
essential.  You can use loop file systems--make a ten gig partition in a 
loop, formated with ext3, but there is a definite speed penalty in doing 
this, and if you are doing it seriously, that is not acceptable.

> [.] I would think that a CD image would be a .iso file which in turn
> would be a loop filesystem, so again how does LVM enter into it?  I did read a

The CD iso would definitely be a loop FS.  However, you are trying to 
install that FreeBSD/NetBSD system on to *something*, right?  That is 
where LVM would enter into it.

Create a 5 gig or 10 gig or what ever logical volume, and tell Xen that 
the drives this virtual has access to, is first the iso loop, and second 
the partition created with LVM.

Now, in all fairness to you, I probably shouldn't have brought this up.  
Since you are just getting started with Xen, and don't already understand 
LVM or understand why you might want it, it might make more sense for you 
to play with loop filesystems, until you get comfortable and serious.

I realized early on that I would need LVM (even though I had never worked 
with it, I knew what it made possible), and so I made it a point to learn 
LVM at the same time I learned Xen.
I was going from zero to a fullly virtualized server in twelve hours flat, 
and knew that I couldn't plan out all of those partitions ahead of time.  
It just semed like the "logical" thing to do, and I don't regret it--I 
have done things on that server because of LVM, that I never could 
For example, I had a user on that 4 gig /home partition I talked about 
before, who needed 30 gig for a while, to backup one of his machines 
during some major maintenance.  I created and formatted a 30 gig logical 
volume, and mounted it under his home partition, and then went on with my 
day.  Took 30 seconds to setup, and a couple minutes to format with ext3.
When he is done with it, I can unmount and delete it, and that space is 
ready again for some other use.

> bit of the manual and it said nothing about any of this.  It said that one
> must use grub as a boot loader.  Does that mean that lilo won't work or are
> they suggesting grub because it's more flexible?

You've got me on that one.  I have no idea why you should have 
to use grub.  However, I haven't used LILO in years, so I may be 
forgetting some of its limitations.
You don't actually use grub or LILO to boot guests, only the host OS.

It may be that grub supports loading the kernel in stages, and LILO does 
not.  I am no expert in what is going on here, but there is the main 
kernel, the ramdisk, and another section which is the host OS kernel.  
>From the grub config file on that server I described above:

title           Xen 3.0-i386-pae / Ubuntu, kernel 2.6.19-4-server
root            (hd0,0)
kernel          /xen-3.0-i386-pae.gz
module          /vmlinuz-2.6.19-4-server root=/dev/mapper/vg--main-lv1 ...
module          /initrd.img-2.6.19-4-server

>  A step by step guide of
> exactly what to do to set up a basic VM would be helpful.  I see that there
> are special xen kernel images and modules, but I'm not sure how I would set up
> a primary and secondary linux VM setup.  For example, I would want to run a
> virtual Linux server inside a host server.  How?  Once I get that working, I

I read the user manual, as well as these sites:
(Note that the above page is claimed to be "old junk".  It didn't have 
that warning when I read it.  The page it links to is probably better, 
but I haven't read it.  You can find it here:

(More graphically orientated than you want, but probably some useful 

> would like to play with NetBSD again since the manual says it has a Xen
> installer.  This still doesn't address how accessible all of this is.  With

At least with Linux as the host, and Linux as the virtual machines, it is 
most highly accessible.

To start a guest machine called "parasite", which you had previously 
setup, and to then have your current terminal become its console, you 
could type:

xm create -c parasite

You will see the boot messages, and eventually a login prompt, usually 
followed by more boot messages.

I usually run screen when doing this, so I can switch over to another 
shell, and do other things, while leaving xm consoles running to my 
various guests.  However, I could also press control right bracket to dump 
out of that console and back to my original shell; and then "xm console 
parasite" to get back to where I left off.
It is generally better to go in via ssh, however, as the xm console can do 
abnormal things with ncurses apps.

> VMWare for example, I have no speech once I start even a text OS like FreeDOS
> unless I load a screen reader.  Would this still apply in Xen?  If so, would

No.  As long as your guest OS runs in text mode, you will not have a 
problem there in most circumstances of which i can think, although i stand 
to be corrected.

> that mean I would need sighted help?  The point for me would be to do 
>this on my own, at least with BSD.

I did it completely on my own.  Well, there was praying, but I don't 
think that's what you meant.

> Sorry for so many questions, but Xen seems
> different than other VM solutions I've seen and I think I'm not grasping
> important things here.

Benchmarks say it is faster, so in that way it is certainly different.:)
I have never used VMWare, because I understand that it is quite 
inaccessible in Linux.  Or at least it was.
Never tried hardware virtualization, because I didn't have the chips.



More information about the Speakup mailing list