From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FmAFI-0006zk-Fi for qemu-devel@nongnu.org; Fri, 02 Jun 2006 10:03:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FmAFG-0006zP-Um for qemu-devel@nongnu.org; Fri, 02 Jun 2006 10:03:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FmAFG-0006zM-P4 for qemu-devel@nongnu.org; Fri, 02 Jun 2006 10:03:22 -0400 Received: from [195.228.240.79] (helo=graveyard3.mail.t-online.hu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FmALk-0006LA-BI for qemu-devel@nongnu.org; Fri, 02 Jun 2006 10:10:04 -0400 Date: Fri, 02 Jun 2006 15:52:13 +0200 Subject: Re: [Qemu-devel] block device loopback References: <5370f2820606010908w7204c1afr17132397ec625c76@mail.gmail.com> From: NyOS Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-2 MIME-Version: 1.0 Message-ID: In-Reply-To: <5370f2820606010908w7204c1afr17132397ec625c76@mail.gmail.com> 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 On Thu, 01 Jun 2006 18:08:56 +0200, s[e]th & h[o]lth =20 wrote: > Hello, > > I'm a qemu user and I'm looking for a way to use my virtual target driv= e > inside my host computer. > I've created a file that I'll call hda.disk like this : "dd if=3D/dev/z= er =20 > of=3D > hda.disk count=3D1 bs=3D1M seek=3D1023" and i use it like "qemu -hda hd= a.disk" > The problem i meet is that i can't use this file outside the virtual =20 > machine > and I'm trying to program a block device driver to read this file as a = =20 > IDE > drive. > The aim of this driver is quite similar to the loop driver but instead = of > "emulating" a partition, it emulates a IDE Hard Drive and give an acces= s =20 > to > it via /dev/vdX and it's partition via /dev/vdXpY. > Perhaps you will wonder why i use the qemu's mailing-list for this =20 > problem : > - i don't know exactly where i can find a way to achieve this project ; > - i wonder how you read your hda.disk without using qemu ; > - i would like to know how qemu fix the virtual drive property inside t= he > virtual machine (cylinders, sectors, etc...) ; > - i don't know anyone interested by this problem and quite good enough = =20 > linux > driver developer to help me. > > Thank you very much and have a nice day ! Hi! how many partitions do you have on that virtual disc image? maybe 1 is =20 enough in most cases.. once i've read on a forum the next 'trick': nyos@nyos:~$ /sbin/fdisk $HOME/image/qemu-win98.img You must set cylinders. You can do this from the extra functions menu. Command (m for help): p Disk /home/nyos/image/qemu-win98.img: 0 MB, 0 bytes 128 heads, 63 sectors/track, 0 cylinders Units =3D cylinders of 8064 * 512 =3D 4128768 bytes Device Boot Start End Blocks= =20 Id System /home/nyos/image/qemu-win98.img1 * 1 520 =20 2096608+ c W95 FAT32 (LBA) Partition 1 has different physical/logical endings: phys=3D(518, 127, 63) logical=3D(519, 127, 63) Command (m for help): q so, there are 63 sectors/track, one track is 512 bytes long, and the 1st = =20 partition starts at 1th track 63*512*1=3D32256 so the following command: sudo mount $HOME/image/qemu-win98.img $HOME/win98loop -o loop,offset=3D32= 256 =20 -t vfat will mount the 1st partition in that image into the apropriate directory = =20 by ignoring the first 32256 bytes of the image leaving only the partition= =20 in it.. hope it helps ------------------------------------------------------------ Light thinks it travels faster than anything but it is wrong. No matter =20 how fast light travels it finds the darkness has always got there first, = =20 and is waiting for it. - Terry Pratchett