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?.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityThe 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?.
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.
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