The official images supplied are raw disk images, which could have been created using dd.

How do I make an image bigger? I'm not interested in repartitioning said image as that has already been answered in How can I resize my / (root) partition?.

  • Not exactly sure what you mean by expanding. Are you looking to perform the 'resizing of the partition' on the image before dd'ing it to the disk?
    – Joost
    Jul 12, 2012 at 8:52
  • That is one goal, but in order to do that, one must expand the disk image. Jul 12, 2012 at 8:55

2 Answers 2


As explained in this question there are two methods of expanding the image. Below are two examples to expand the file by 1 kilobyte.

DD creates a non-sparse file

dd if=/dev/zero bs=1k count=1 >> myimage.img

Truncate creates a sparse file

truncate -s +1024 myimage

You probably want to use truncate. A sparse file only writes the metadata of the blocks it uses, instead of actually writing the blocks. This makes creating the file faster (as it does not have to write actual zero's to the disk) and it saves space on your disk.

Note Apple's HFS+ filesystem does not support sparse files.

  • HFS+ doesn't conform to POSIX? linux.die.net/man/2/truncate Jul 12, 2012 at 9:37
  • If supporting sparse files is a requirement for POSIX i guess not. Here is a nice demonstration of the differences between HFS+ and some ext (i guess) stackoverflow.com/a/193015/689893. Appearently it does creates the file but it uses disk space like it's a normal file instead of a sparse file.
    – Joost
    Jul 12, 2012 at 9:54
  • No, I think I had misunderstood! Jul 12, 2012 at 10:13
  • If you dd a sparse file, will it still be right? Jul 12, 2012 at 10:14
  • A sparse file does contain data, so i guess you can just add zeroes. It will handle that part as non-sparse.
    – Joost
    Jul 12, 2012 at 10:32

An incredibly easy way of resizing the image is to use one of the qemu tools called qemu-img. This of course depends on the fact that you have qemu installed (which I know you already do Alex).

The command looks like this:

qemu-img resize filename [+|-]size[K|M|G|T]

Where filename is the image file, and size is the size you want to enlarge (or shrink) the image.

For example, if you want to extend the image archarm.img by 2GB you would execute:

qemu-img resize archarm.img +2G
  • Refering to manpage, Before using this command to shrink a disk image, you MUST use file system and partitioning tools inside the VM to reduce allocated file systems and partition sizes accordingly. Failure to do so will result in data loss!
    – AntonioK
    Oct 10, 2015 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.