/ #raspberry-pi #pishrink 

PiShrink

PiShrink tool

$ wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
$ chmod +x ./pishrink.sh

$ sudo dd if=/dev/mmcblk0 of=xenialpi.img bs=1M

$ sudo ./pishrink.sh ./xenialpi.img

$ flash -d /dev/mmcblk0 xenialpi.img
# or
$ sudo dd if=~/xenialpi.img of=/dev/mmcblk0
sudo dd if=/dev/mmcblk0 of=xenialpi-mininet.img bs=1M
sudo ./pishrink.sh ./xenialpi-mininet.img

sudo dd if=/dev/mmcblk0 of=xenialpi-mininet-wifi.img bs=1M
sudo ./pishrink.sh ./xenialpi-mininet-wifi.img
em@v3468:~/Apps$ sudo ./pishrink.sh ./xenialpi.img
Creating new /etc/rc.local
cloudimg-rootfs: 91268/1918208 files (0.1% non-contiguous), 535803/3855739 blocks
resize2fs 1.42.13 (17-May-2015)
resize2fs 1.42.13 (17-May-2015)
Resizing the filesystem on /dev/loop6 to 678827 (4k) blocks.
Begin pass 2 (max = 46159)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 118)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 14714)
Updating inode references     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop6 is now 678827 (4k) blocks long.

Shrunk ./xenialpi.img from 15G to 2,8G