Resizing Raspbian image for QEmu

I’m running Raspbian (Wheesy 2013-05-29) under QEmu just to make dev a bit quicker. The problem goes that the Raspbian image is 2GB which leaves only 200Mb free for apps/data.

To resize the image, start by resizing the image and giving it an extra 2GB (this is run on the host):

> qemu-img resize 2013-05-29-wheezy-armel.img +2G

Now boot into Raspbian and issue the following to resize the partition (from within linux):

1. > sudo fdisk /dev/sda
2. Print the partition table ("p"). Take note of the starting block of the main partition
3. Delete the main partition ("d"). Should be partition 2.
4. Create (n)ew partition. (P)rimary. Position (2)
5. Start block should be the same as start block from the original partition
6. Size should be the full size of the image file (just press "enter")
7. Now write the partition table (w)
8. Reboot (shutdown -r now). After reboot,
9. > sudo resize2fs /dev/sda2


When that’s all done, run “df -h” and you should have plenty of space.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>