I'm trying to figure out a way to create an image on my SD card. My SD card is 16 GB but I have not changed the original partition size. All the software that I use to create an IMG file with always creates a 16 GB file and not a 2 GB as I would expect.

# df -H

Filesystem      Size  Used Avail Use% Mounted on
rootfs          1.9G  1.3G  508M  72% /
/dev/root       1.9G  1.3G  508M  72% /
devtmpfs        122M     0  122M   0% /dev
tmpfs           122M     0  122M   0% /dev/shm
tmpfs           122M  275k  121M   1% /run
tmpfs           122M     0  122M   0% /sys/fs/cgroup
tmpfs           122M     0  122M   0% /tmp
/dev/mmcblk0p1   99M   21M   79M  21% /boot

The programs I have tried are:

  • Win32DiskImager
  • HDDRawCopy1.02Portable
  • DiskImage_1_6_WinAll

I have downloaded and ran Arch Linux for RPi, installed some software and now I want to create a new image for distribution. But it is creating a 16GB file rather than a 2 GB file (hoping for a 1.5 GB file or less).

I have the original 2 partitions on the SD card: #fdisk -l

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *        2048      194559       96256    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          194560     3862527     1833984   83  Linux

I need to create the IMG file from a Windows computer.

  • I'm not sure this will be possible... At first I thought you could grab the entire 16GB and then remove the last 14GB, leaving you with the data you want. But SD cards have wear levelling which spreads the data across the card. I have no idea if that will have an effect.
    – Jivings
    Commented Oct 26, 2012 at 16:55

2 Answers 2


You could use the raspberry pi to create an image of itself. You'll need a USB stick to store the image on. Alternatively you could send the image out to a windows share, if you don't have one, but the USB stick would probably be easiest.

To create an image of the first partition, mount the usb stick, on /mnt/usbstick and run the following.

sudo dd if=/dev/mmcblk0 of=/mnt/usbstick/raspberry.img bs=1M count=2048

That will copy off the first 2 GB of the current SD card. You should be able to put this image on a 2GB SD Card. If you want a 1.5 GB image file, the only way you can do that is by compressing the img file. You could probably compress the 16 GB image down to less that 1.5 GB assuming the unused part of the image contains zeroes. The 2 GB image will compress to less than 1.5 GB almost certainly.


While trying to re-distribute a customized Raspbian OS, I had the same question with respect to making the image as small as possible. To make this process easy I wrote mkimg.sh and outline what it does at: https://raspberrypi.stackexchange.com/a/37899/32585

Your Answer

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

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