* [Qemu-devel] fdisk give wrong number for losetup
@ 2005-07-07 10:36 octane indice
2005-07-07 13:10 ` Jim C. Brown
2005-07-10 5:16 ` Henrik Nordstrom
0 siblings, 2 replies; 5+ messages in thread
From: octane indice @ 2005-07-07 10:36 UTC (permalink / raw)
To: qemu-devel
Hello
I have some trouble using losetup to mount partitions
from the host.
root@zipslack:/usr/src/qemu-test# fdisk -l zipslack.img
Vous devez initialiser cylindres.
Vous pouvez faire cela à partir du menu des fonctions additionnelles.
Disque zipslack.img: 0 Mo, 0 octets
16 têtes, 63 secteurs/piste, 0 cylindres
Unités = cylindres de 1008 * 512 = 516096 octets
Périphérique Amorce Début Fin Blocs Id Système
zipslack.img1 1 49 24664+ 82 Linux swap
zipslack.img2 50 253 102816 83 Linux
zipslack.img3 254 609 179424 83 Linux
root@zipslack:/usr/src/qemu-test#losetup -f
/dev/loop1
root@zipslack:/usr/src/qemu-test# losetup -o $((50*512)) /dev/loop1 zipslack.img
root@zipslack:/usr/src/qemu-test# mount -t ext2 /dev/loop1 /mnt/hd
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
root@zipslack:/usr/src/qemu-test# sfdisk zipslack.img
AVERTISSEMENT: zipslack.img n'est pas un périphérique fonctionnant par blocs
Disque zipslack.img: ne peut obtenir la géométrie
Disque zipslack.img: 0 cylindres, 0 têtes, 0 secteurs/piste
Vieille situation:
AVERTISSEMENT: la table de partitions semble avoir été créée
pour C/H/S=*/16/63 (au lieu de 0/0/0).
Pour ce rapport, la géométrie suivante sera assumée.
Unités= cylindres de 516096 octets, blocs de 1024 octets, décompte à partir de 0
Périph Amor Début Fin #cyls #blocs Id Système
zipslack.img1 0+ 48 49- 24664+ 82 Linux swap
zipslack.img2 49 252 204 102816 83 Linux
zipslack.img3 253 608 356 179424 83 Linux
zipslack.img4 0 - 0 0 0 Vide
L'entrée utiliser un des formats suivants; les champs absents prennent
la valeur par défaut:
<début> <taille> <type [E,S,L,X,hex]> <amorçable [-,*]> <c,h,s> <c,h,s>
Habituellement vous n'avez besoin que de spécifier:
<début> et <taille> (et parfois <type>).
zipslack.img1 :
root@zipslack:/usr/src/qemu-test#
root@zipslack:/usr/src/qemu-test# losetup -f
/dev/loop2
root@zipslack:/usr/src/qemu-test# losetup -o $((49*516096)) /dev/loop2
zipslack.img
root@zipslack:/usr/src/qemu-test# mount -t ext2 /dev/loop2 /mnt/hd/
root@zipslack:/usr/src/qemu-test# ls /mnt/hd/
bin/ cdrom/ etc/ home/ lib/ mnt/ root/ tmp/ var/
boot/ dev/ faq.txt install/ lost+found/ proc/ sbin/ usr/ vmlinuz
root@zipslack:/usr/src/qemu-test#
And now, my questions: why this?
fdisk doesn't give the good values?
what's this number given by sfdisk: 516096 ?
thanks
---------------------------------------------
Etes vous un consom'Acteur ? Toutes les saveurs équitables sont sur http://www.epicerie-equitable.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] fdisk give wrong number for losetup
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
2005-07-10 5:16 ` Henrik Nordstrom
1 sibling, 1 reply; 5+ messages in thread
From: Jim C. Brown @ 2005-07-07 13:10 UTC (permalink / raw)
To: qemu-devel
On Thu, Jul 07, 2005 at 12:36:08PM +0200, octane indice wrote:
> Hello
>
> 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.
>
> 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.)
>
> ---------------------------------------------
> Etes vous un consom'Acteur ? Toutes les saveurs ?quitables sont sur http://www.epicerie-equitable.com
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
--
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] fdisk give wrong number for losetup
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 5:16 ` Henrik Nordstrom
1 sibling, 0 replies; 5+ messages in thread
From: Henrik Nordstrom @ 2005-07-10 5:16 UTC (permalink / raw)
To: qemu-devel
On Thu, 7 Jul 2005, octane indice wrote:
> Hello
>
> I have some trouble using losetup to mount partitions
> from the host.
>
> root@zipslack:/usr/src/qemu-test# fdisk -l zipslack.img
> Vous devez initialiser cylindres.
> Vous pouvez faire cela à partir du menu des fonctions additionnelles.
>
> Disque zipslack.img: 0 Mo, 0 octets
> 16 têtes, 63 secteurs/piste, 0 cylindres
> Unités = cylindres de 1008 * 512 = 516096 octets
>
> Périphérique Amorce Début Fin Blocs Id Système
> zipslack.img1 1 49 24664+ 82 Linux swap
> zipslack.img2 50 253 102816 83 Linux
> zipslack.img3 254 609 179424 83 Linux
fdisk -l -u zipslack.img
or
sfdisk -d zipslack.img
gives a much better view of the partition table.. (blocks, not cylinders)
Regards
Henrik
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] fdisk give wrong number for losetup
2005-07-07 13:10 ` Jim C. Brown
@ 2005-07-10 17:01 ` octane
2005-07-11 2:15 ` Henrik Nordstrom
0 siblings, 1 reply; 5+ messages in thread
From: octane @ 2005-07-10 17:01 UTC (permalink / raw)
To: qemu-devel
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] fdisk give wrong number for losetup
2005-07-10 17:01 ` octane
@ 2005-07-11 2:15 ` Henrik Nordstrom
0 siblings, 0 replies; 5+ messages in thread
From: Henrik Nordstrom @ 2005-07-11 2:15 UTC (permalink / raw)
To: qemu-devel
On Sun, 10 Jul 2005, octane wrote:
> 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
The offset if 67*516096, as this partition table is printed in cylinders,
not sectors.
When calculating partition offsets it is always best to look at the
partition table in sectors, not cylinders, especially considering that
partitions does not need to start exactly on a cylinder boundary. For
example the first partition doesn't start at cylinder 1, it starts at
cylinder 1 head 2, or sector 64. Both fdisk and sfdisk supports viewing
the sector based partition values, maintaining sanity.
>> 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.)
Nearly nobody except for DOS (and the parts of BIOS used by DOS) cares
about geometry..
> 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))
Correct, from the cylinders/heads/sectors geometry. If you look at the
swap partition then things is more interesting.. (also why sfdisk printed
a + there, and probably what the + in the blocks column of fdisk
refers to...)
Regards
Henrik
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-07-11 2:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2005-07-11 2:15 ` Henrik Nordstrom
2005-07-10 5:16 ` Henrik Nordstrom
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.