On Wed, Apr 04, 2012 at 09:45:18AM +0100, Richard W.M. Jones wrote:
# 9GB sda1
part-add /dev/sda p 64 $(( 9*1024*1024*2 ))
# remainder in sda2
part-add /dev/sda p $(( 9*1024*1024*2 + 1 )) -64
This leaves the swap partition unaligned :-(
If you care about alignment (and you probably should) then this will
create properly aligned partitions:
part-add /dev/sda p 128 $(( 9*1024*1024*2 - 1 ))
part-add /dev/sda p $(( 9*1024*1024*2 )) -128
'Course the 'virt-alignment-scan' tool can be used to detect if your
partitions are aligned correctly. With the original image:
$ virt-alignment-scan -a test.img
/dev/sda1 32768 32K bad (alignment < 64K)
/dev/sda2 9663676928 512 bad (alignment < 4K)
With the correctly aligned image:
$ virt-alignment-scan -a test.img
/dev/sda1 65536 64K ok
/dev/sda2 9663676416 1048576K ok
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org