image by qemu-img and bximage has different size

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
chunis
Posts: 4
Joined: Mon Mar 26, 2012 9:45 pm

image by qemu-img and bximage has different size

Post by chunis »

Hi, I want to create a 80M hard disk image.
Using bximage, I got 83607552 bytes, and qemu-img give me 83886080 bytes.
Looks like 83886080B = 80*1024*1024 is right. But why they are not equal? and how to translate 83886080B to numbers for .bxrc file?
Thanks very much!
User avatar
brain
Member
Member
Posts: 247
Joined: Thu Nov 05, 2009 5:04 pm
Location: UK
Discord: https://discord.gg/brainbox
GitHub: https://github.com/braindigitalis
Contact:

Re: image by qemu-img and bximage has different size

Post by brain »

Well ive just read the source of bximage and it should create raw sectors. So in short both should be about the same size, are you sure it didnt error and terminate early?
chunis
Posts: 4
Joined: Mon Mar 26, 2012 9:45 pm

Re: image by qemu-img and bximage has different size

Post by chunis »

Thanks for help.
I've checked again, and now I'm sure the difference is because bochs will round down the size to a multiply of (16*63*512) bytes.
In my case, it is (16*63*512)*162 = 83607552. And (16*63*512)*163 = 84123648 is larger than 80M=83886080B already.
Tried with different sizes, it always produced a line like:
ata0-master: type=disk, path="x.img", mode=flat, cylinders=162, heads=16, spt=63
And always just the cylinders value will be changed.
BTW, I now know how to get the same value in qemu-img now with: :D
$ qemu-img create x.img $((162*63*16*512))
User avatar
Yoda
Member
Member
Posts: 255
Joined: Tue Mar 09, 2010 8:57 am
Location: Moscow, Russia

Re: image by qemu-img and bximage has different size

Post by Yoda »

chunis wrote:In my case, it is (16*63*512)*162 = 83607552. And (16*63*512)*163 = 84123648 is larger than 80M=83886080B already.
Tried with different sizes, it always produced a line like:
ata0-master: type=disk, path="x.img", mode=flat, cylinders=162, heads=16, spt=63
That's because XXX*16*63 (where XXX is the number of tracks) is the physical geometry used in ATA interface.
Yet Other Developer of Architecture.
OS Boot Tools.
Russian national OSDev forum.
Post Reply