Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Setting up vnd devices for disks



On 3/15/10 6:41 PM, Greg Troxel wrote:

Louis Guillaume<louis%zabrico.com@localhost>  writes:

I'm setting up my dom0 and would like to organize all the disk space
for the hosted domains in one place (/srv/xen). And I want to do it in
the most flexible and/or efficient way.

To me, that means files for the virtual disks, accessed via vnd.

o What benefits do we gain from using vnd devices in our xen
   configurations over regular files?

It works.  Basically, on a NetBSD dom0, to provide a disk to a domU
requires a block device on the dom0.  This can be done with an actual
block device (partition of a disk), or a file-backed vnd.

o What's the correct practice for managing vnd devices? Other than
   having a script to vnconfig them each time we boot, how should
   these be tracked?

In your xen config,

   disk = [ 'file:/n0/xen/foo-wd0,0x1,w']

makes that file be the contents of xbd0.

Any help clarifying this would be great. I'm using netbsd-5/amd64 for
dom0 with a recent xenkernel33 and xentools33.

When you start up a domU, the scripts create a vnd and attach it to the
file.

Ok - I get the overall way the block devices or files are mapped into the guest machines. But I'm still confused here:

I can create a regular file and make it available as a disk using

  disk = [ 'file:/srv/xen/host-disk0,0x1,w' ]

... as you described. But why do we need the vnd device? Just accessing the file itself does the trick for domU. Is some vnconfigging going on automatically that I don't know about? I can also do this...

  disk = [ 'phy:/dev/vnd0d,0x05,w' ]

... and get effectively the same results, except that I'm *referencing* the vnd device in the config. Essentially that means ALL my vnd devices must be configured BEFORE I start up the guests.

What would be the benefit of the latter situation? If I wanted to configure any of my files as vnd devices I can just vnconfig a vnd device on those files and voila! I see everything; partition map; disklabel - everything.

I still don't see any reason for vnd here.

The advantage of the file/vnd appraoch is that you can resize disks with
dump/restore on the dom0 and new files, and they live in a big fs.  With
partitions it is messier.  But with partitions you skip dom0 fs
overhead, which is perhaps 10%.

Ok - I get this. We can vnconfig in dom0 to access the data in our guest system. That is a perfectly valid use here. But it hasn't anything to do with xen, or the xen configuration/booting environment.

When you create the first disk, so so by dd'ing zeros onto the entire
planned size.  vnd/xen does not play well with sparse files, and you
want it all pre-allocated for good locality anyway.

I am unaware of how to make xen virtual disks work with a file without
vnd.

I just dd'd zeros to a file (as you're suggesting here) and added it to the config as shown above. Of course that device needs to be partitioned and disklabeled once we're in the guest, but that's no problem. But I did this with no vnd device. And that's why I started this whole thread! I could see no benefit to vnd at all!

So perhaps my problem is that I was thinking that vnd devices are somehow presented to the guest systems in some kind of a "special" way that provides some benefit. Perhaps better performance or something. It seems, though, that vnd is simply a convenience that we can use in dom0 to peer into our guests' data and possibly update them while they are cold. Yes?

Thanks for looking!

Louis



Home | Main Index | Thread Index | Old Index