All of lore.kernel.org
 help / color / mirror / Atom feed
From: octane <octane@alinto.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] fdisk give wrong number for losetup
Date: Sun, 10 Jul 2005 19:01:06 +0200	[thread overview]
Message-ID: <42D15452.6050202@alinto.com> (raw)
In-Reply-To: <20050707131054.GA5461@jbrown.mylinuxbox.org>

Jim C. Brown a écrit :

>>I have some trouble using losetup to mount partitions
>>from the host.
>>    
>>
>
>I never realized how difficult it was to interpret error messages written in
>a foreign language.
>
>  
>
Ok, sorry, in plain english messages are:
root@zipslack:/usr/src/qemu-test# fdisk -l zipslack.img
You must set cylinders.
You can do this from the extra functions menu.

Disk zipslack.img: 0 MB, 0 bytes
16 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

       Device Boot      Start         End      Blocks   Id  System
zipslack.img1               1          66       33232+  82  Linux swap
zipslack.img2              67         609      273672   83  Linux
root@zipslack:/usr/src/qemu-test#

and mounting the file with an offset of $((67*512)) doesn't work

root@zipslack:/usr/src/qemu-test# sfdisk zipslack.img
Warning: zipslack.img is not a block device
Disk zipslack.img: cannot get geometry

Disk zipslack.img: 0 cylinders, 0 heads, 0 sectors/track
Old situation:
Warning: The partition table looks like it was made
  for C/H/S=*/16/63 (instead of 0/0/0).
For this listing I'll assume that geometry.
Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
zipslack.img1          0+     65      66-     33232+  82  Linux swap
zipslack.img2         66     608     543     273672   83  Linux
zipslack.img3          0       -       0          0    0  Empty
zipslack.img4          0       -       0          0    0  Empty
Input in the following format; absent fields get a default value.
<start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>
Usually you only need to specify <start> and <size> (and perhaps <type>).

zipslack.img1 :

And mounting with $((66*516096)) is ok.


>>And now, my questions: why this?
>>    
>>
>
>Because you were passing the wrong value as the offset. You have to multipy
>the cylinder with the number of heads and number of sectors per head and such.
>  
>
>>what's this number given by sfdisk: 516096 ?
>>

>>Apparently, head*sectors per head*bytes per sector ... my fdisk doesn't show
>>that number though.
>>
>>    
>>
>>fdisk doesn't give the good values?
>>
>>thanks
>>    
>>
>
>It does, but they are hard to interpret unless you understand disk geometries.
>
>I really recommend using lomount or some similar tool to figure out these
>offsets for you. (Incidently, lomount doesn't care about disk geometry - it
>uses the absolute sector values in the partition table.)
>  
>
I receive a mail that says:
fdisk -l zipslack.img is not the same as fdisk- lu zipslack :
root@zipslack:/usr/src/qemu-test# fdisk -lu zipslack.img
You must set cylinders.
You can do this from the extra functions menu.

Disk zipslack.img: 0 MB, 0 bytes
16 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes

       Device Boot      Start         End      Blocks   Id  System
zipslack.img1              63       66527       33232+  82  Linux swap
zipslack.img2           66528      613871      273672   83  Linux

and incidently $((66*516096))=$((66528*512))

thanks.

  reply	other threads:[~2005-07-10 17:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-07 10:36 [Qemu-devel] fdisk give wrong number for losetup octane indice
2005-07-07 13:10 ` Jim C. Brown
2005-07-10 17:01   ` octane [this message]
2005-07-11  2:15     ` Henrik Nordstrom
2005-07-10  5:16 ` Henrik Nordstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42D15452.6050202@alinto.com \
    --to=octane@alinto.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.