Hi, I''m trying to convert a number of PV domains to HVM domains. The snag is they''re all in separate partitions, so I need to get a unified disk image. My current plan is to mount the root of dom0 inside a booted domu (single user mode) and dd the entire contents of the virtual disk /dev/sda into a file on the dom0 disk. Is this likely to work? It''s gonna be slow I know due to the dom0->domu->dom0 translation but is there perhaps a faster way? I presume xen itself creates a partition table somewhere and if I could get at that and do it entire thing in dom0... is this just a python script generating it at runtime or is it stored somewhere? Tony _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Tue, 2007-06-05 at 01:08 +0100, Tony Hoyle wrote:> Hi, > > I''m trying to convert a number of PV domains to HVM domains. The snag > is they''re all in separate partitions, so I need to get a unified disk > image. > > My current plan is to mount the root of dom0 inside a booted domu > (single user mode) and dd the entire contents of the virtual disk > /dev/sda into a file on the dom0 disk. Is this likely to work? It''s > gonna be slow I know due to the dom0->domu->dom0 translation but is > there perhaps a faster way? I presume xen itself creates a partition > table somewhere and if I could get at that and do it entire thing in > dom0... is this just a python script generating it at runtime or is it > stored somewhere? > > TonyWhy not setup the hvm guests to use nfsroots with a brand spanking new unpartitioned image as well? Just fdisk, format, copy over adjust config / boot paramaters and reboot. This also lets you work the neuances you''ll need to address in udev and others when converting. Well , may need to. I have no idea what you have or I''d make more distro specific suggestions. Just setup the nfs server on dom-0. I don''t use HVM much, but I don''t see any reason why that wouldn''t work. Seems like the easiest way to go for me. Its quite easy to break up var/ usr/ and the rest doing it like that. Hope this helps, --Tim _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
If i understand it''s linux domain. 1. make a disk file qemu-img for example 2. mount the partition of you PV in the dom0 and the qemu disk-file 3. make a rsync -a between the two mount point 4. make a /boot with kernel, initrd .... 5. running in hvm mode on a linux live cdrom 6. install a grub or a lilo Regards Yves Tony Hoyle a écrit :> Hi, > > I''m trying to convert a number of PV domains to HVM domains. The snag > is they''re all in separate partitions, so I need to get a unified disk > image. > > My current plan is to mount the root of dom0 inside a booted domu > (single user mode) and dd the entire contents of the virtual disk > /dev/sda into a file on the dom0 disk. Is this likely to work? It''s > gonna be slow I know due to the dom0->domu->dom0 translation but is > there perhaps a faster way? I presume xen itself creates a partition > table somewhere and if I could get at that and do it entire thing in > dom0... is this just a python script generating it at runtime or is it > stored somewhere? > > Tony > > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >-- Yves-Gaël Chény Responsable développements techniques Responsable Achats techniques Responsable RH technique 261 route de Clisson 44230 St Sébastien sur Loire Tel : 02 40 97 62 67 - 08 73 77 24 91 http://www.tranquilitsystems.com/ yves-gael.cheny@tranquil-it-systems.fr Tranquil IT Systems . SAS 37 000 ¤ _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tim Post wrote:> On Tue, 2007-06-05 at 01:08 +0100, Tony Hoyle wrote: > >> Hi, >> >> I''m trying to convert a number of PV domains to HVM domains. The snag >> is they''re all in separate partitions, so I need to get a unified disk >> image. >> >> My current plan is to mount the root of dom0 inside a booted domu >> (single user mode) and dd the entire contents of the virtual disk >> /dev/sda into a file on the dom0 disk. Is this likely to work? It''s >> gonna be slow I know due to the dom0->domu->dom0 translation but is >> there perhaps a faster way? I presume xen itself creates a partition >> table somewhere and if I could get at that and do it entire thing in >> dom0... is this just a python script generating it at runtime or is it >> stored somewhere? >> >> Tony >> > > Why not setup the hvm guests to use nfsroots with a brand spanking new > unpartitioned image as well? Just fdisk, format, copy over adjust > config / boot paramaters and reboot. > > This also lets you work the neuances you''ll need to address in udev and > others when converting. Well , may need to. I have no idea what you have > or I''d make more distro specific suggestions. > > Just setup the nfs server on dom-0. I don''t use HVM much, but I don''t > see any reason why that wouldn''t work. > > Seems like the easiest way to go for me. Its quite easy to break up var/ > usr/ and the rest doing it like that. >Hmm. You''re going to have fun and games with partitioning. If you''re using a system that does network boot well, it may be feasible to pre-transfer your OS images into an appropriately built lfile image or partition, then use a "rescue" boot mode to boot ot the console form installation sources and successfully set up grub or something else. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
> -----Original Message----- > From: xen-users-bounces@lists.xensource.com > [mailto:xen-users-bounces@lists.xensource.com] On Behalf Of Tony Hoyle > Sent: 05 June 2007 01:08 > To: xen-users@lists.xensource.com > Subject: [Xen-users] Best way to convert pv to hvm? > > Hi, > > I''m trying to convert a number of PV domains to HVM domains. > The snag > is they''re all in separate partitions, so I need to get a > unified disk > image.I know this doesn''t help the actual question you have, but: Why would you want to move from PV to HVM? It is decidedly not the "right" direction to go in my opinion (and I have no political reason to say so, rather the opposite, as I only do HVM development). PV is faster than HVM, so why would you want to move to HVM? -- mas _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tim Post wrote:> Why not setup the hvm guests to use nfsroots with a brand spanking new > unpartitioned image as well? Just fdisk, format, copy over adjust > config / boot paramaters and reboot.NFS just isn''t practical given the network performance of a domu. I''m trying to keep this as much in dom0 as possible to keep the downtime low. It''s a one time operation but some of the servers are in use (not critical, but I still get complaints if they''re down too long). Tony _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Yves-gaël Chény wrote:> If i understand it''s linux domain. > > 1. make a disk file qemu-img for example > 2. mount the partition of you PV in the dom0 and the qemu disk-file > 3. make a rsync -a between the two mount point > 4. make a /boot with kernel, initrd .... > 5. running in hvm mode on a linux live cdrom > 6. install a grub or a lilo >Step 2 is an issue though, since it''s a whole disk image you have a partition table - you can''t simply mount it, unless there''s some way to convert it into a block device in userspace (AFAIK loop devices only work on partitions). Tony _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Tue, 2007-06-05 at 09:52 +0100, Nico Kadel-Garcia wrote:> Tim Post wrote: > > On Tue, 2007-06-05 at 01:08 +0100, Tony Hoyle wrote: > > > >> Hi, > >> > >> I''m trying to convert a number of PV domains to HVM domains. The snag > >> is they''re all in separate partitions, so I need to get a unified disk > >> image. > >> > >> My current plan is to mount the root of dom0 inside a booted domu > >> (single user mode) and dd the entire contents of the virtual disk > >> /dev/sda into a file on the dom0 disk. Is this likely to work? It''s > >> gonna be slow I know due to the dom0->domu->dom0 translation but is > >> there perhaps a faster way? I presume xen itself creates a partition > >> table somewhere and if I could get at that and do it entire thing in > >> dom0... is this just a python script generating it at runtime or is it > >> stored somewhere? > >> > >> Tony > >> > > > > Why not setup the hvm guests to use nfsroots with a brand spanking new > > unpartitioned image as well? Just fdisk, format, copy over adjust > > config / boot paramaters and reboot. > > > > This also lets you work the neuances you''ll need to address in udev and > > others when converting. Well , may need to. I have no idea what you have > > or I''d make more distro specific suggestions. > > > > Just setup the nfs server on dom-0. I don''t use HVM much, but I don''t > > see any reason why that wouldn''t work. > > > > Seems like the easiest way to go for me. Its quite easy to break up var/ > > usr/ and the rest doing it like that. > > > > Hmm. You''re going to have fun and games with partitioning. If you''re > using a system that does network boot well, it may be feasible to > pre-transfer your OS images into an appropriately built lfile image or > partition, then use a "rescue" boot mode to boot ot the console form > installation sources and successfully set up grub or something else.Well, he did say from PV to HVM, I can''t think of anything PV that can''t be made to play nicely with a NFS root. But there very well may be. You can install grub and stuff prior to starting the process via the PV guests OS packaging mechanism which also gives you the appropriate native kernel and modules in most cases, commonly people forget about the modules and wonder why it won''t boot. I guess my method could be a nightmare if circumstances were just right, but I''ve yet to run into those circumstances even with older kernels. My lab mate just installs a vanilla version of the PV guest on a new hvm domain, lomounts it and copies the old stuff over. Always works for him but I''m not quite that brave. This same person drinks 5 cups of coffee + 4 ''generic jolt'' colas per day. Best, --Tim _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Petersson, Mats wrote:> I know this doesn''t help the actual question you have, but: Why would > you want to move from PV to HVM? It is decidedly not the "right" > direction to go in my opinion (and I have no political reason to say so, > rather the opposite, as I only do HVM development). PV is faster than > HVM, so why would you want to move to HVM? >It''s not HVM that''s the issue (just simplifies the question) just the requirement for a complete disk image rather than separate partitions. It frees me to switch between technologies - at the moment Xen isn''t usable for my situation so I''ll be temporarily using VMWare with an eye on future Xen development or possibly Kvm when it matures. Once you have the image you have the ability to switch with only driver/environment issues to worry about. Tony _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tony Hoyle wrote:> Yves-gaël Chény wrote: >> If i understand it''s linux domain. >> >> 1. make a disk file qemu-img for example >> 2. mount the partition of you PV in the dom0 and the qemu disk-file >> 3. make a rsync -a between the two mount point >> 4. make a /boot with kernel, initrd .... >> 5. running in hvm mode on a linux live cdrom >> 6. install a grub or a lilo >> > Step 2 is an issue though, since it''s a whole disk image you have a > partition table - > you can''t simply mount it, unless there''s some way to convert it into a > block device > in userspace (AFAIK loop devices only work on partitions).You can mount it, using the lomount utility provided in /usr/lib/xen/bin: lomount -diskimage /dev/vg/lv -partition 1 /mnt/wherever> > Tony > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >-- Didier Trosset-Moreau Agilent Technologies Geneva, Switzerland _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Tue, 2007-06-05 at 10:28 +0100, Tony Hoyle wrote:> Tim Post wrote: > > Why not setup the hvm guests to use nfsroots with a brand spanking new > > unpartitioned image as well? Just fdisk, format, copy over adjust > > config / boot paramaters and reboot. > > NFS just isn''t practical given the network performance of a domu.I''m not saying keep the nfs root, I''m saying boot the HVM with an empty block device attached to it FROM the PV guests file system using a nfs root, format your HVM''s block device, copy, done. Take the nfsroot out of the configuration after that. I have the same question Mats does, why would you want to do it in the first place? Best, --Tim _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
I''ll run through what I''m thinking once more, a little more coherently. Step 1 - on the guest, install the packager''s kernel, modules, grub, configs, everything that you would find on a normal server. Step 2 - Stop the guest. Step 3 - Copy said kernel that you just installed to where you need it to be. Boot the guest passing the nfsroot option so that it mounts the PV''s file system as / , while also passing a blank block device you can slice up using the disk tools already present on the PV guest. Step 4 - Boot, fix udev, copy everything over, take the nfsroot out of the equation Done. Just boot the VM now converted to HVM, nuke the PV guests file system since its no longer being used. Not sure why you would want to do that, but it seems to be the path of least resistance unless of course your''e able to work with lomount / fdisk / parted from dom-0 :) Don''t forget the swap space. Best, --Tim On Tue, 2007-06-05 at 10:28 +0100, Tony Hoyle wrote:> Tim Post wrote: > > Why not setup the hvm guests to use nfsroots with a brand spanking new > > unpartitioned image as well? Just fdisk, format, copy over adjust > > config / boot paramaters and reboot. > > NFS just isn''t practical given the network performance of a domu. > > I''m trying to keep this as much in dom0 as possible to keep the downtime low. It''s > a one time operation but some of the servers are in use (not critical, but I > still get complaints if they''re down too long). > > Tony > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Didier Trosset wrote:> You can mount it, using the lomount utility provided in /usr/lib/xen/bin: > > lomount -diskimage /dev/vg/lv -partition 1 /mnt/wherever >That works if you have already partitioned and formatted the image, not otherwise. I can do that in the domu I guess. Tony _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Tue, 2007-06-05 at 10:39 +0100, Tony Hoyle wrote:> Petersson, Mats wrote: > > I know this doesn''t help the actual question you have, but: Why would > > you want to move from PV to HVM? It is decidedly not the "right" > > direction to go in my opinion (and I have no political reason to say so, > > rather the opposite, as I only do HVM development). PV is faster than > > HVM, so why would you want to move to HVM? > > > It''s not HVM that''s the issue (just simplifies the question) just the requirement > for a complete disk image rather than separate partitions. It frees me to switch > between technologies - at the moment Xen isn''t usable for my situation so I''ll be > temporarily using VMWare with an eye on future Xen development or possibly > Kvm when it matures. Once you have the image you have the ability to switch with > only driver/environment issues to worry about. > > Tony >Tony, this is probably best accomplished scripted utilizing lomount. Actually the proper way to do it would be design an application to do it and talk to ioctl directly. Its not really just a Xen tool then, its a tool for Virtuailzation in general which is, well, lomount. I was saying there''s no elegant tool to do it, I didn''t mean to imply there isn''t an elegant *way* to do it. The ideal version of what you describe is a ''no brainer'' to use and ''just works''. Given that in either direction you shoot yourself in the foot, I still can''t see how it would be useful. PV guests don''t do so well with sliced VBD''s. Likewise , as you said keeping a copy in sync to go to HVM isn''t very practical. Even thinking of throwing network storage in to help abstract the problem, I can''t come up with a good way. I don''t like iscsi on dom-0, and I don''t want to set my AOE_SHELVES back to 16, nor do I want aoe-1 and aoe-2 running together to serve the purpose. But, the idea of what you describe would be neat. So please don''t think I''m saying its a bad idea. Its a good idea, just every way to implement it seems bad, unless you had some other ideas? Now your question makes a LOT more sense to me. Sorry for the confusion on my part :) Best, --Tim> _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tony Hoyle wrote:> Didier Trosset wrote: > >> You can mount it, using the lomount utility provided in /usr/lib/xen/bin: >> >> lomount -diskimage /dev/vg/lv -partition 1 /mnt/wherever >> > That works if you have already partitioned and formatted the image, not > otherwise. I > can do that in the domu I guess.I''ve to admit I never tried, but I''d guess it is possible to use both fdisk and mkfs on /dev/vg/lv. Within dom0, I can use fdisk -l to look at the partition table. # fdisk -l /dev/vg1/xen008-disk Disk /dev/vg1/xen008-disk: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vg1/xen008-disk1 1 62 497983+ 82 Linux swap / Solaris /dev/vg1/xen008-disk2 * 63 1044 7887915 83 Linux Didier> > Tony > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >-- Didier Trosset-Moreau Agilent Technologies Geneva, Switzerland _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Didier Trosset wrote:> I''ve to admit I never tried, but I''d guess it is possible to use both > fdisk and mkfs on /dev/vg/lv. Within dom0, I can use fdisk -l to look at > the partition table.fdisk even works on files... The only wrinkle is the requirement to tell it how many cylinders there are. mkfs doesn''t unfortunately - it needs a real disk device. Tony _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tim Post wrote:> Tony, this is probably best accomplished scripted utilizing lomount. > Actually the proper way to do it would be design an application to do it > and talk to ioctl directly.That''s a lot of effort! It''s not as if I''m going to be changing every week.> I was saying there''s no elegant tool to do it, I didn''t mean to imply > there isn''t an elegant *way* to do it. The ideal version of what you > describe is a ''no brainer'' to use and ''just works''.It would be nice if qemu-img could do it, since conversion is its job. Really all it needs is a way to take an image/lvm partition/whatever and treat it as a drive, then it could be scripted in bash. nbd almost does it.. it creates a block device, but then doesn''t scan the partition table (wonder how hard that would be to add??).> Given that in either direction you shoot yourself in the foot, I still > can''t see how it would be useful. PV guests don''t do so well with sliced > VBD''s. Likewise , as you said keeping a copy in sync to go to HVM isn''t > very practical.Well individual partitions is a xen-ism, so it''s a reasonable tradeoff to me to ditch that and gain the option of easiler mobility as the technologies change. Tony _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tim Post wrote:> Well, he did say from PV to HVM, I can''t think of anything PV that can''t > be made to play nicely with a NFS root. But there very well may be. > > You can install grub and stuff prior to starting the process via the PV > guests OS packaging mechanism which also gives you the appropriate > native kernel and modules in most cases, commonly people forget about > the modules and wonder why it won''t boot. > > I guess my method could be a nightmare if circumstances were just right, > but I''ve yet to run into those circumstances even with older kernels. >I find the reverse, that NFS booting works well only when the circumstances are just right. I''ve attempted to NFS boot in distributions that didn''t support it natively, and have had *serious* problems with it. (SuSE: it had to be SuSE......) _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tim Post wrote:> I''ll run through what I''m thinking once more, a little more coherently. > > Step 1 - on the guest, install the packager''s kernel, modules, grub, > configs, everything that you would find on a normal server. > > Step 2 - Stop the guest. > > Step 3 - Copy said kernel that you just installed to where you need it > to be. Boot the guest passing the nfsroot option so that it mounts the > PV''s file system as / , while also passing a blank block device you can > slice up using the disk tools already present on the PV guest. > > Step 4 - Boot, fix udev, copy everything over, take the nfsroot out of > the equation > > Done. Just boot the VM now converted to HVM, nuke the PV guests file > system since its no longer being used. > > Not sure why you would want to do that, but it seems to be the path of > least resistance unless of course your''e able to work with lomount / > fdisk / parted from dom-0 :) > > Don''t forget the swap space. >Hmmph. Think about this: 1: Power off the old DomU. 2: Mount and make a tarball of the partition. 3: Boot the HVM in live CD or rescue CD or network boot mode. This gives you access to the next step. 4: Pre-partition the disk visible iin rescue mode. (There is no need for LVM, or extended partitions: you can add new disk drives via Xen later if necessary.) 5: Mount the new partitons. 6: Download and extract the tarballs on top of the mounted partitions. 7: Edit the mounted /etc/fstab and /etc/mtab to match your setup. 8: Reboot with the CD or network boots in "install" mode, and do an update install. This should get you grub or lilo, configured to match your system. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Nico Kadel-Garcia wrote:> Hmmph. Think about this: > > 1: Power off the old DomU. > > 2: Mount and make a tarball of the partition. > > 3: Boot the HVM in live CD or rescue CD or network boot mode. This gives > you access to the next step. > > 4: Pre-partition the disk visible iin rescue mode. (There is no need for > LVM, or extended partitions: you can add new disk drives via Xen later > if necessary.) > > 5: Mount the new partitons. > > 6: Download and extract the tarballs on top of the mounted partitions. > > 7: Edit the mounted /etc/fstab and /etc/mtab to match your setup. > > 8: Reboot with the CD or network boots in "install" mode, and do an > update install. This should get you grub or lilo, configured to match > your system.I ended up with: Power off the domu. Create a large disk file to hold the data. Edit the .cfg file to add this to the domu. Power on the domu, and fdisk/mkfs on the new virtual disk. Power off the domu. Mount the new partition and the old partition Do rsync -av between new and old. Make any required fstab alterations. Alter the cfg file to remove the old partions and just use the new file. Power on the domu. Make sure everything works. Install grub/kernel/etc. If I could work out a way of making the mkfs work without having to boot the domu with the virtual file it would be a lot quicker... could probably even script it (well maybe not the fstab stuff). Tony _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Tue, 2007-06-05 at 20:50 +0100, Nico Kadel-Garcia wrote:> Hmmph. Think about this: >Hmm. I think this is the best of the two. I''ve never had problems with nfsroots, but I don''t use SuSE. Regardless, you''re right, guided partitioning would be easier for most people. I also have a coffee cup that says I (heart) Sed. Sometimes I forget :) Best, --Tim _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tim Post wrote:> On Tue, 2007-06-05 at 20:50 +0100, Nico Kadel-Garcia wrote: > > >> Hmmph. Think about this: >> >> > > Hmm. I think this is the best of the two. I''ve never had problems with > nfsroots, but I don''t use SuSE. Regardless, you''re right, guided > partitioning would be easier for most people. > > I also have a coffee cup that says I (heart) Sed. Sometimes I forget :) > > Best, > --TimAwk! A sed lover! _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users