Here is a quick tip I posted on my blog: http://aubreykloppers.wordpress.com
Here’s the thing:
You bought a Raspberry Pi, a 2GB SD card and downloaded a 2GB IMG to create your awesome project, just to find the card is too small to write the IMG file to! The reason for this is that you bought a 2GB SD card, but technically it is only about 1.8G in size! (1MB=1024768b, work it out from there!)
Software/Hardware used for this example:
- Raspberry Pi
2GB SD Card
RuneAudio (2GB image)
Win32DiskImager
I used a Generic Turnkey Linux OS to shrink the IMG.
Steps (as root):
Enable loopback:
- Code: Select all
modprobe loop
Create a 1.8G image:
- Code: Select all
dd bs=1M count=1700 if=/dev/zero of=NEW.img
Mount image as /dev/loop0:
- Code: Select all
losetup -f --show NEW.img
Unzip 2GB image:
- Code: Select all
gunzip RuneAudio_rpi_0.3-beta_20141029_2GB.img.gz
Mount image as /dev/loop1:
- Code: Select all
losetup -f --show RuneAudio_rpi_0.3-beta_20141029_2GB.img
Write 2GB image onto 1.8GB image:
- Code: Select all
dd if=/dev/loop1 of=/dev/loop0
Check the different sizes:
- Code: Select all
fdisk -l /dev/loop1
fdisk -l /dev/loop0
Unmount the images and zip your new image:
- Code: Select all
losetup -d /dev/loop0 /dev/loop1
mv NEW.img RuneAudio_rpi_0.3-beta_20141029_1.8GB.img
gzip RuneAudio_rpi_0.3-beta_20141029_1.8GB.img
You now have a 1.8G image fitting on a 2GB SD Card. Neat, hey?