Resizing Raspbian image for QEmu

June 2nd, 2013 by Xerxes Leave a reply »

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.


Be Sociable, Share!

1 comment

  1. electronic says:

    I used to be suggested this web site by means of my cousin. I’m no longer certain whether or not this publish is written through him as no one else understand such unique about my problem. You are incredible! Thanks!