From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DrfX7-0007WA-LY for qemu-devel@nongnu.org; Sun, 10 Jul 2005 13:24:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DrfWn-0007OJ-4N for qemu-devel@nongnu.org; Sun, 10 Jul 2005 13:23:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DrfWl-0007He-6D for qemu-devel@nongnu.org; Sun, 10 Jul 2005 13:23:39 -0400 Received: from [82.216.145.218] (helo=zipslack.local.tux) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DrfMB-0006fv-US for qemu-devel@nongnu.org; Sun, 10 Jul 2005 13:12:44 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) by zipslack.local.tux (Postfix) with ESMTP id 624554E21 for ; Sun, 10 Jul 2005 19:01:08 +0200 (CEST) Message-ID: <42D15452.6050202@alinto.com> Date: Sun, 10 Jul 2005 19:01:06 +0200 From: octane MIME-Version: 1.0 Subject: Re: [Qemu-devel] fdisk give wrong number for losetup References: <1120732568.42cd0598078bd@webmail.alinto.com> <20050707131054.GA5461@jbrown.mylinuxbox.org> In-Reply-To: <20050707131054.GA5461@jbrown.mylinuxbox.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Jim C. Brown a =E9crit : >>I have some trouble using losetup to mount partitions >>from the host. >> =20 >> > >I never realized how difficult it was to interpret error messages writte= n in >a foreign language. > > =20 > 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 =3D cylinders of 1008 * 512 =3D 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=3D*/16/63 (instead of 0/0/0). For this listing I'll assume that geometry. Units =3D 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. Usually you only need to specify and (and perhaps ). zipslack.img1 : And mounting with $((66*516096)) is ok. >>And now, my questions: why this? >> =20 >> > >Because you were passing the wrong value as the offset. You have to mult= ipy >the cylinder with the number of heads and number of sectors per head and= such. > =20 > >>what's this number given by sfdisk: 516096 ? >> >>Apparently, head*sectors per head*bytes per sector ... my fdisk doesn't= show >>that number though. >> >> =20 >> >>fdisk doesn't give the good values? >> >>thanks >> =20 >> > >It does, but they are hard to interpret unless you understand disk geome= tries. > >I really recommend using lomount or some similar tool to figure out thes= e >offsets for you. (Incidently, lomount doesn't care about disk geometry -= it >uses the absolute sector values in the partition table.) > =20 > 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 =3D sectors of 1 * 512 =3D 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))=3D$((66528*512)) thanks.