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] mount a .img file

To: John Weekes <lists.xen@xxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-users] mount a .img file
From: chris <tknchris@xxxxxxxxx>
Date: Thu, 13 Jan 2011 19:26:33 -0500
Cc: Chris Petrolino <cpetrolino@xxxxxxxxx>, xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 13 Jan 2011 16:28:41 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=RAzFmgqA4eclIPYXyXkfnDnv2uzHQoRS59WAuohJX6g=; b=a2IT8nfDAeb9975uaCN7R44NrVFVd2+z9DyXlAykUNsdhZTlpLGuIpxz423LFx7EVf YjKuv6MlmyOsWNRvO8Pl/74ONW6IvIEJFGG2fZNjf/3RmbdysCqYfCbPsqA4y8UgYf7R BuN0Vo+sscqcEEGvyCYnlWzlbiHPo058QDSqM=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=bgOjnlD+VwEMlDF62lHXNzZ851iy9s+IeL9lyRhbfFsjjFzVwEyJWIB9OX/hKyd2nA e8zKdrXj9htFqsO/qpa/Tu01p5t4OBy1BqkWmFvPESRwj6u6Hm5RhugIDt/pQR0E29Ld iEdAWrEyI/wa98nCPZrmjoC7D4zK4T83KHA6U=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4D2F94EA.6080508@xxxxxxxxxxxxxxxxxx>
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>
References: <AANLkTinj3bFbUPXXNvb17F39tCrM-dsFS24XZ8Ax5xTk@xxxxxxxxxxxxxx> <Pine.LNX.4.64.1101131550370.16650@xxxxxxxxxxxxxxx> <4D2F7635.70606@xxxxxxxxxxxxxxx> <2B1F9B30-1CCF-48E0-AF77-0D028642E51F@xxxxxxxxx> <4D2F94EA.6080508@xxxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
kpartx is one the most useful utilities ever created :)

On Thu, Jan 13, 2011 at 7:12 PM, John Weekes
<lists.xen@xxxxxxxxxxxxxxxxxx> wrote:
> To save yourself from having to calculate an offset, you could also mount
> the whole image and then use the "kpartx" command to map out the partitions
> for you.
>
> -John
>
> On 1/13/2011 2:05 PM, Chris Petrolino wrote:
>>
>> Aha that's most likely what I was forgetting! I will give that a shot and
>> report back. Thanks a million guys
>>
>> Kind Regards,
>>
>> Christopher James Petrolino
>>
>>
>> On Jan 13, 2011, at 5:01 PM, dave<dave@xxxxxxxxxxxxxxx>  wrote:
>>
>>> If it's a disk image you need to provide an offset, for example
>>>
>>> mount -o loop,offset=32256 /xen/guest.img /mnt/tmp
>>>
>>> the offset depends on the partitioning of the disk file.  for example:
>>>
>>> ~$ fdisk -l -u -c guest.img
>>>
>>>    Device Boot      Start         End      Blocks   Id  System
>>> guest.img1   *        2048     9920511     4959232   83  Linux
>>> guest.img2         9922558    10483711      280577    5  Extended
>>> guest.img5         9922560    10483711      280576   82  Linux swap /
>>> Solaris
>>>
>>> this disk image has a 2048 cylinder boot sector, so the offset would be
>>> 2048*512, or 1048576
>>>
>>> another example:
>>>
>>> ~$ fdisk -l -u -c guestA.img
>>>
>>>     Device Boot      Start         End      Blocks   Id  System
>>> guestA.img1   *          63     1767149      883543+  83  Linux
>>> guestA.img2         1767150     1992059      112455    5  Extended
>>> guestA.img5         1767213     1992059      112423+  82  Linux swap /
>>> Solaris
>>>
>>> this has a 63 cyl boot sector, so the offset would be 63*512 = 32256.
>>>
>>> as a shortcut, (in bash shell) you can do this:
>>>
>>> mount -o loop,offset=$((512*63)) guestA.img /mnt/tmp
>>>
>>>
>>>
>>> On 01/13/2011 01:51 PM, Steven Timm wrote:
>>>>
>>>> What's the output of
>>>>
>>>> file /xen/guest.img
>>>>
>>>> probably you need to specify -t ext2
>>>> but the file command will tell you for sure.
>>>>
>>>> Steve
>>>>
>>>>
>>>> On Thu, 13 Jan 2011, Christopher J Petrolino wrote:
>>>>
>>>>> Ok guys I am wondering if anyone can help me out here. I am trying to
>>>>> mount a xen .img file. when I try to do a mount -o loop /xen/guest.img
>>>>> /mnt/tmp I get a message saying that I need to specify a partition
>>>>> type.. What am I missing?
>>>>>
>>>>> Many thanks in advance,
>>>>>
>>>>> CJP
>>>>>
>>>>> _______________________________________________
>>>>> Xen-users mailing list
>>>>> Xen-users@xxxxxxxxxxxxxxxxxxx
>>>>> http://lists.xensource.com/xen-users
>>>>>
>> _______________________________________________
>> Xen-users mailing list
>> Xen-users@xxxxxxxxxxxxxxxxxxx
>> http://lists.xensource.com/xen-users
>
> _______________________________________________
> Xen-users mailing list
> Xen-users@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-users
>

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

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