qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] fdisk give wrong number for losetup


From: octane
Subject: Re: [Qemu-devel] fdisk give wrong number for losetup
Date: Sun, 10 Jul 2005 19:01:06 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

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:
address@hidden:/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
address@hidden:/usr/src/qemu-test#

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

address@hidden:/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 :
address@hidden:/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 via email to

[Prev in Thread] Current Thread [Next in Thread]