[ARMedslack] qemu raw image partition offset calculation
It's often handy to know the physical offset of the first partition of a qemu raw disk image. If you do not use raw images you can convert it to raw ... do what you need and convert it back. I've not yet found a reliable way of mounting non raw images from ordinary linux OS. You can use this trick to populate a qemu disk image with an armedslack miniroot sistem image directky from your linux x86 box. Unfortunatelly the offset depends on the geometry of the disk image. Here's how I guess the correct offset: the firs block of the firs partition is located in: the first sector of the second track it will be located in * 512 example: fdisk -l qemu_hdu.raw Disk qemu_hdu.raw: 0 MB, 0 bytes 5 heads, 54 sectors/track, 0 cylinders Units = cylinders of 270 * 512 = 138240 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x Device Boot Start End Blocks Id System qemu_hdu.raw1 11016 137133 83 Linux the firs partition of this image (qemu_hdu.raw1) will begin: (54 * 512) = 27648 Ho do you go about creating the filesystem from the x86 linux box: What folows creates an ext2 filesystem on the first partition of the qemu raw disk image and subsequently mount is so that you can polulate it. # losetup -o /dev/loop0 qemu_hdu.raw # mke2fs -b 4096 -i 16384 -m 1 -L surap_root /dev/loop0 # mount /dev/loop0 /mnt/tmp/ Hope this helps David ___ ARMedslack mailing list ARMedslack@lists.armedslack.org http://lists.armedslack.org/mailman/listinfo/armedslack
Re: [ARMedslack] qemu raw image partition offset calculation
Yep this is all good stuff. ftp://ftp.armedslack.org/armedslack/armedslack-devtools/sheevaplug/qemu-to-sheeva.txt I haven't digested everything you've put down but the above URL is how I bootstrapped armedslack onto the sheevaplug -- converting a qemu installation back to a bootable hard disk. On Fri, 6 May 2011, Davide wrote: > It's often handy to know the physical offset of the first partition of a qemu > raw disk image. > If you do not use raw images you can convert it to raw ... do what you need > and convert it back. > I've not yet found a reliable way of mounting non raw images from ordinary > linux OS. > You can use this trick to populate a qemu disk image with an armedslack > miniroot sistem image directky from your linux x86 box. > > Unfortunatelly the offset depends on the geometry of the disk image. > Here's how I guess the correct offset: > > the firs block of the firs partition is located in: > the first sector of the second track > it will be located in * 512 > > example: > fdisk -l qemu_hdu.raw > Disk qemu_hdu.raw: 0 MB, 0 bytes > 5 heads, 54 sectors/track, 0 cylinders > Units = cylinders of 270 * 512 = 138240 bytes > Sector size (logical/physical): 512 bytes / 512 bytes > I/O size (minimum/optimal): 512 bytes / 512 bytes > Disk identifier: 0x > >Device Boot Start End Blocks Id System > qemu_hdu.raw1 11016 137133 83 Linux > > the firs partition of this image (qemu_hdu.raw1) will begin: > (54 * 512) = 27648 > > > > Ho do you go about creating the filesystem from the x86 linux box: > > What folows creates an ext2 filesystem on the first partition of the > qemu raw disk image and subsequently mount is so that you can polulate it. > > # losetup -o /dev/loop0 qemu_hdu.raw > # mke2fs -b 4096 -i 16384 -m 1 -L surap_root /dev/loop0 > # mount /dev/loop0 /mnt/tmp/ > > Hope this helps > David > > > ___ > ARMedslack mailing list > ARMedslack@lists.armedslack.org > http://lists.armedslack.org/mailman/listinfo/armedslack > -- Stuart Winter Slackware ARM: www.armedslack.org ___ ARMedslack mailing list ARMedslack@lists.armedslack.org http://lists.armedslack.org/mailman/listinfo/armedslack
Re: [ARMedslack] qemu raw image partition offset calculation
Not sure what you're not digesting but if I can help make things more clear I will ... just tell me what's not so clear. I wanted to do hings in the other direction: from a miniroot fs image (or my microroot system) to a qemu disk image so that I can do testing without having the dockstar around in the office. I had trouble starting from a blank disk image created with the qemu-img tool and populating it with what I wanted without going trough any installation. Regards David --- Lun 9/5/11, Stuart Winter ha scritto: > Da: Stuart Winter > Oggetto: Re: [ARMedslack] qemu raw image partition offset calculation > A: "Slackware ARM port" > Data: Lunedì 9 maggio 2011, 08:22 > > Yep this is all good stuff. > ftp://ftp.armedslack.org/armedslack/armedslack-devtools/sheevaplug/qemu-to-sheeva.txt > > I haven't digested everything you've put down but the above > URL is how I > bootstrapped armedslack onto the sheevaplug -- converting a > qemu > installation back to a bootable hard disk. > > On Fri, 6 May 2011, Davide wrote: > > > It's often handy to know the physical offset of the > first partition of a qemu raw disk image. > > If you do not use raw images you can convert it to raw > ... do what you need and convert it back. > > I've not yet found a reliable way of mounting non raw > images from ordinary linux OS. > > You can use this trick to populate a qemu disk image > with an armedslack miniroot sistem image directky from your > linux x86 box. > > > > Unfortunatelly the offset depends on the geometry of > the disk image. > > Here's how I guess the correct offset: > > > > the firs block of the firs partition is located in: > > the first sector of the second track > > it will be located in * 512 > > > > example: > > fdisk -l qemu_hdu.raw > > Disk qemu_hdu.raw: 0 MB, 0 bytes > > 5 heads, 54 sectors/track, 0 cylinders > > Units = cylinders of 270 * 512 = 138240 bytes > > Sector size (logical/physical): 512 bytes / 512 bytes > > I/O size (minimum/optimal): 512 bytes / 512 bytes > > Disk identifier: 0x > > > > Device Boot > Start End > Blocks Id System > > qemu_hdu.raw1 > 1 1016 > 137133 83 Linux > > > > the firs partition of this image (qemu_hdu.raw1) will > begin: > > (54 * 512) = 27648 > > > > > > > > Ho do you go about creating the filesystem from the > x86 linux box: > > > > What folows creates an ext2 filesystem on the first > partition of the > > qemu raw disk image and subsequently mount is so that > you can polulate it. > > > > # losetup -o > /dev/loop0 qemu_hdu.raw > > # mke2fs -b 4096 -i 16384 -m 1 -L surap_root > /dev/loop0 > > # mount /dev/loop0 /mnt/tmp/ > > > > Hope this helps > > David > > > > > > ___ > > ARMedslack mailing list > > ARMedslack@lists.armedslack.org > > http://lists.armedslack.org/mailman/listinfo/armedslack > > > > -- > Stuart Winter > Slackware ARM: www.armedslack.org > ___ > ARMedslack mailing list > ARMedslack@lists.armedslack.org > http://lists.armedslack.org/mailman/listinfo/armedslack > ___ ARMedslack mailing list ARMedslack@lists.armedslack.org http://lists.armedslack.org/mailman/listinfo/armedslack
Re: [ARMedslack] qemu raw image partition offset calculation
Heh. I should wait a few hours after getting up to look at emails :-) On Mon, 9 May 2011, Davide wrote: > Not sure what you're not digesting but if I can help make things more clear I > will ... just tell me what's not so clear. > > I wanted to do hings in the other direction: from a miniroot fs image > (or my microroot system) to a qemu disk image so that I can do testing > without having the dockstar around in the office. > > I had trouble starting from a blank disk image created with the qemu-img > tool and populating it with what I wanted without going trough any > installation. ___ ARMedslack mailing list ARMedslack@lists.armedslack.org http://lists.armedslack.org/mailman/listinfo/armedslack