Jak zálohovat Raspberry Pi SD kartu v Linuxu a zmenšit ji na skutečnou velikost


Instalace:

wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh

chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin

Použití:

pishrink.sh [-adhrsvzZ] imagefile.img [newimagefile.img]
  -s         Don't expand filesystem when image is booted the first time
  -v         Be verbose
  -r         Use advanced filesystem repair option if the normal one fails
  -z         Compress image after shrinking with gzip
  -Z         Compress image after shrinking with xz
  -a         Compress image in parallel using multiple cores
  -d         Write debug messages in a debug log file


sudo dd bs=4M if=/dev/sdb of=raspberry_image-`date +%Y%m%d`.img status=progres

sudo pishrink.sh -v raspberry_image-20240118.img