WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] mounting a filesystem image

To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-users] mounting a filesystem image
From: Maarten Vanraes <maarten@xxxxx>
Date: Thu, 29 Oct 2009 14:53:28 +0200
Cc: geert Geurts <begeert@xxxxxxxxx>, Marcel van Dorp <M.vanDorp@xxxxxxx>
Delivery-date: Thu, 29 Oct 2009 05:56:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4AE98B61.8060503@xxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Organization: BA
References: <db00b3d70910290420o69ff9a7fl573be19600255615@xxxxxxxxxxxxxx> <4AE98B61.8060503@xxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.9
what about using a tap frontend device?

'xm block-attach tap:aio:/path/to/disk.img xvdb w'

this should make xvdb1 and xvdb2, etc...

Op Thursday 29 October 2009 13:32:33 schreef Marcel van Dorp:
> geert Geurts wrote:
> > Hello list,
> > I'm a quit newby on xen, I'm studying  for CLP...
> > I've got a domU setup and running without problems, I made a image using
> > dd and formated after that using losetup to associate it to a loopdevice
> > and than fdisk loopdevice to create two partitions on the image. So i've
> > got /home/geert/xen/opensuse11/disk.img as my disk image, and it
> > contains 2 partitions one swap device and one root partition.
> > They function as axpected and I'm a happy man. Except for one problem...
> > How can I mount the second partition on the host computer? I mean I can
> > losetup -f /home/geert.../disk.img and then fdisk -l /dev/loop0 shows my
> > two partitions but how can I access those partitions?
> >
> > Thanks!
> >
> > Greetings,
> > Geert
>
> part1: You need losetup with an offset to skip the partition table, and
> part2: You need losetup with an offset to skip the first partition.
>
> In short:
>
> losetup the complete image (assuming /dev/loop0 as new device)
>
> fdisk /dev/loop0
>
> Write down #bytes per sector (usually 512)
>
> option u to change units to sectors
> option m to print the partition table
>
>
> for each partition, write down Start and Blocks value
>
> exit, and remove loop device
>
> Calculate first offset = Start sector * sector size,
> usually 63 * 512 = 32256
>
> Now you can reconnect image on loop device, using the offset:
>
> losetup -o 32256 /dev/loop0 binary.img
>
> finally make a filesystem
>
> mkfs -t ext3 -b1024 /dev/loop0 [#blocks of part1]
>
> Repeat with values for second partition, and use another loop device (eg
> /dev/loop1)
>
> losetup -o [offset2] /dev/loop1 binary.img
> mkswap /dev/loop1 [#blocks of part2]
>
>
> Finally you can mount the first partiton, and use 'swapon' for the
> second partition.
>
>
> That should do it.
>
> Marcel
>
> _______________________________________________
> Xen-users mailing list
> Xen-users@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-users



-- 
BA N.V. - http://www.ba.be

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>