[Fedora-xen] Createing/working with disk images

Andrew Cathrow acathrow at redhat.com
Wed Mar 28 00:52:39 UTC 2007


Yep,

It's referenced in the quickstart

http://fedoraproject.org/wiki/FedoraXenQuickstartFC6


On Tue, 2007-03-27 at 17:27 -0600, Lamont Peterson wrote:

> On Tuesday 27 March 2007 03:58pm, Andrew Cathrow wrote:
> > Run kpartx to create the devices - will be created in /dev/mapper
> 
> Hmm.  I'd run into something that mentioned the use of kpartx (I think is was 
> in some openSUSE 10.2 Xen documentation), but looking at it's man page, it 
> didn't look like the right tool to create the devices.
> 
> > kpartx -a /dev/loop0
> 
> So, I'm supposed to:
> 
> 1.  Create the image file.
> 2.  Run "losetup /dev/loop0 /whatever/path/to/the/imagefile"
> 3.  Run "fdisk /dev/loop0" to create the partitions.
> 4.  Run "kpartx -a /dev/loop0" which will create /dev/mapper/* devices for the 
> partitions on /dev/loop0.
> 
> Have I got that right?
> 
> > On Tue, 2007-03-27 at 15:32 -0600, Lamont Peterson wrote:
> > > All,
> > >
> > > I need to create some images that pygrub can boot (on FC6 & RHEL5). 
> > > IIUC, that means that the image file must be a disk image complete with
> > > partition table.
> > >
> > > The trouble I'm running into is figuring out how to access the
> > > "partition" within the disk image file as a block device.  This is
> > > necessary in order to format or mount the filesystems and run mkswap for
> > > the disk image's swap partition.
> > >
> > > Here's what I have so far.
> > >
> > > 1.  Create the disk image file, ala "dd if=/dev/zero
> > > of=/var/lib/xen/images/someVM/sda bs=1k seek=4608k count=1"
> > >
> > > 2.  Create partitions with fdisk (this requires setting the number of
> > > cylinders, but that's easy).
> > >
> > > 3.  losetup /dev/loop0 /var/lib/xen/images/someVM/sda
> > >
> > > At this point, I can run "fdisk -l /dev/loop0" and get:
> > >
> > > Disk /dev/loop0: 4831 MB, 4831839232 bytes
> > > 255 heads, 63 sectors/track, 587 cylinders
> > > Units = cylinders of 16065 * 512 = 8225280 bytes
> > >
> > >       Device Boot      Start         End      Blocks   Id  System
> > > /dev/loop0p1               1         523     4200966   83  Linux
> > > /dev/loop0p2             524         588      522112+  82  Linux swap /
> > > Solaris
> > >
> > > However, there is no /dev/loop0p1 or /dev/loop0p2 devices and I'm not
> > > sure what to do to make those accessible.  I need to be able
> > > to "mke2fs -j /dev/loop0p1" and "mkswap /dev/loop0p2" or equivalent. 
> > > Then I need to mount /dev/loop0p1 to copy files to it.
> > >
> > > How can I access partitions inside a disk image as block devices?  Should
> > > I be using something other than losetup here?
> > > --
> > > Fedora-xen mailing list
> > > Fedora-xen at redhat.com
> > > https://www.redhat.com/mailman/listinfo/fedora-xen
> 
> --
> Fedora-xen mailing list
> Fedora-xen at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-xen


Andrew Cathrow
Red Hat, Inc.

(678) 733 0452 - Mobile
(404) 437 6178 - Home Office

acathrow at redhat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-xen/attachments/20070327/86501f46/attachment.htm>


More information about the Fedora-xen mailing list