Pi Backup
Time for another text based pi article.. sorry!
Attach the USB disk to the pi.
Next download pi shrink
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh sudo chmod +x pishrink.sh sudo mv pishrink.sh /usr/local/bin
Next check for the correct paths
lsblk
Now run a dd copy to create the image
sudo dd if=/dev/mmcblk0 of=[mount point]/myimg.img bs=1M
Finally shrink the image
sudo pishrink.sh -z myimg.img
You now have a size optimized image that you can restore using the “official” pi image writer software. You can stick this in a cron job to create a regular image backup of any pi.
VNC
If you are cloning to test or deploy into another Pi, you will need to delete the VNC config or you will get a “cloned” error in the VNC client and it could stop working. Luckily it’s simple to fix, on the cloned machine do the following:
sudo systemctl stop vncserver-x11-serviced sudo rm -rf /root/.vnc sudo systemctl start vncserver-x11-serviced