[SOLVED] How to shrink an SD card image
-
I have been looking for an answer to this issue for months and have found several instructions but none of them worked for me. I finally figured it out and thought I would share here.
I knew it had to be simple, but just wasn't finding it. Most of the instructions out there included working on a Linux machine even after the resizing through Gparted. This process I outline only uses Gparted (if needed) and Win32DiskImager. The key is using the correct version of Win32DiskImager which is not the latest version.
Please comment below and let me know if this worked for you.
There are only 2 steps to this process and can both be accomplished on a Windows machine.
- Shrink the data sector on the SD card using Gparted (if needed).
- Create an image file using the appropriate Win32DiskImager.
- The data in the allocated area being backed up in step 2 must be smaller than the target SD card, if it is not the following process can be used.
If the allocated area needs to be resized (shrunk), use Gparted to shrink the sector on the SD card.
NOTE: GParted only resizes sectors, not the image files. The image file will be shrunk in the second step.
Gparted instructions:
Boot PC into Gparted. From a Windows PC, a Gparted CD must be created using the following ISO file (gparted-live-0.28.1-1-amd64.iso) which can be downloaded from http://gparted.sourceforge.net/download.php.
NOTE: The file must be 'burned' to the disk, not just copied and burned. Use Free ISO Burner at freeisoburner.com.
OPTIONAL - If the PC you are using does not have an optical drive installed, the ISO can be saved to a USB drive. This can be done with isotousb_setup.exe which can be downloaded from http://www.isotousb.com/. Once the ISO is properly setup on the USB drive, boot the PC from that drive to start the Gparted utility.
I'm not going to go into the Gparted instructions here as there are many resources for that part. I suggest starting with the instructions at https://www.lifewire.com/use-gparted-to-partition-hard-drive-2205693
Once the allocated sector is below the size of the new SD card use Win32 Disk Imager - 1.0 to read the SD card. The file name is win32diskimager-1.0.0-install.exe
IMPORTANT: Version 1.0 must be used and can be downloaded from https://www.techspot.com/downloads/5361-win32-disk-imager.html. The 1.0 version allows an option to read only allocated partitions where the later versions do not.
#1 Enter the path and file name of the image you are reading from the SD card (i.e. C:/samplerpi.img)
#2 Choose the path of the SD card (i.e. D:)
#3 Make sure to put a check-mark in Read Only Allocated Partitions.
Failure to do this will make an image of the entire size of the image including the unallocated space. This option is not in later versions and is what hung me up for quite some time.
#4 Choose the Read buttonOnce you make the new smaller image, it can be used on any SD card of that size or larger.
I hope others will find this helpful.
-
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.