Create Image

To create an image, follow these steps:

1. Prepare Raspberry Pi

Set up and configure a Raspberry Pi exactly as desired for later deployment.

If your Raspberry Pi has a UUID file, make sure you remove it before creating the image.

To reduce size:

sudo apt-get clean

2. Connect SD card

Connect the SD card to a Linux device.

Warning: When using an SD-card reader in a VM, connect the entire reader directly to the VM.
Windows displays multiple devices for an SD card due to multiple partitions.

3. Identify SD card

Find the entire SD card (not just a single partition):

lsblk

4. Create image

Run the following command.
Replace sdX with the value from lsblk:

sudo dd if=/dev/sdX of=Desktop/raspi-sf-v1.img bs=4M status=progress

Wait until the copying process is fully completed.

5. Use PiShrink (shrink image)

  1. Download script from GitHub:
    https://github.com/Drewsif/PiShrink

  2. Make script executable:
    chmod +x pishrink.sh

  3. Run PiShrink:
    sudo ./pishrink.sh Desktop/raspi-sf-v1.img