On 1 April 2014 17:45, Arnaud Patard <[email protected]> wrote:

> olivier sallou <[email protected]> writes:
>
> > Hi,
>
> Hi,
>
> > I just wanted to give a status on my depvts for bootstrap-vz for Azure.
> >
> > I can build at the moment a vhd disk file to be used as an image.
> However i
> > do not even reach (yet) the boot. Indeed, Azure requires an image disk to
> > be a multiple of 1024 bits.
> > Though my partitions are multiple of 1024 bits, it seems that generated
> > image is not fine for it....
>
> Unless it has changed, it's not 1024 bits, but it's 1MB. According to my
> notes, I was getting this error message otherwise:
> "The size must be a whole number (in MBs)."
> [ with azure node js tool ]
>
> >
> > For the moment I generate a raw image with Azure agent and convert it to
> > vhd files.
> > Indeed, kpartx seems to fail on vhd disks at grub install:
> >
> > Installing grub
> > device-mapper: resume ioctl on vdc2 failed: Invalid argument
> > create/reload failed on vdc2
> > Command 'kpartx -a /dev/mapper/vdc' returned non-zero exit status 1
>
> You can create an image file understood by qemu (and other tools) in
> order to install grub & co. Then, use something like that:
> roundedsize=$((($size/(1024*1024)+1)*(1024*1024)))
> qemu-img resize $image $roundedsize
> qemu-img convert -o subformat=fixed -O vpc $image $vhd
>
> [ this code is a small part of
> http://git.hupstream.com/?p=projects/azure-image.git;a=summary. I guess
> it can be improved but at least it was working last time I used it ]
>
> Arnaud
>
>
>
> --
> To UNSUBSCRIBE, email to [email protected]
> with a subject of "unsubscribe". Trouble? Contact
> [email protected]
> Archive: https://lists.debian.org/[email protected]
>
>
> roundedsize=$((($size/(1024*1024)+1)*(1024*1024)))
... or you could use my little Bytes class that handles byte units for you:
https://github.com/andsens/bootstrap-vz/blob/f315915a73ed8b073741dc47bdf20eadbbe9aa57/common/bytes.py
Just import with:
from common.bytes import Bytes
It can parse most normal formats for size specification.

Reply via email to