PiShrink
Project Homepage: https://github.com/Drewsif/PiShrink
PiShrink is a bash script that automatically shrink a pi image that will then resize to the max size of the SD card on boot. This will make putting the image back onto the SD card faster and the shrunk images will compress better.
Usage
sudo pishrink.sh [-s] imagefile.img [newimagefile.img]
If the -s option is given the script will skip the autoexpanding part of the process. If you specify the newimagefile.img parameter, the script will make a copy of imagefile.img and work off that. You will need enough space to make a full copy of the image to use that option.
Installation
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin
Windows Installation
curiosthedeadcat followed these instructions for setting this up in Windows. You will need a linux virtual machine.
https://www.reddit.com/r/RetroPie/comments/6csva9/how_to_shrink_retropie_backup_image_made_easy/
1. Install Ubuntu w/ VMPlayer via this link: https://www.htpcguides.com/install-ubuntu-virtual-machine-with-vmplayer-on-windows/
2. Create a shared folder between Ubuntu and Windows: http://theholmesoffice.com/how-to-share-folders-between-windows-and-ubuntu-using-vmware-player/
3. Copy both the .img and pishrink files into it.
4. Go into Terminal within the directory both the pishrink and .img files are stored
5. Enter command: [[code]]sudo ./pishrink.sh [filename.img] [[/code]]
6. Enter Password (if required)
Edit: Recent issues with Ubuntu 16.04.4 not recognizing the sudo vmware-config-tools.pl command forced me to track down this method to located a shared folder, originally found at https://askubuntu.com/questions/762755/no-vmhgfs-file-system-installed-to-use-use-shared-folder: $ sudo apt-get install git $ git clone https://github.com/rasa/vmware-tools-patches.git $ cd vmware-tools-patches $ sudo ./patched-open-vm-tools.sh
Other Useful Links
https://www.reddit.com/r/raspberry_pi/comments/92bh6v/pishrink_for_mac_with_docker/