Creating a Disk Image

The below is details on generating a DietPi disk image for distribution.

Prep operating system

First we need to prepare the operating system

  • Make sure to remove wifi settings from /boot/dietpi-wifi.txt
  • Make sure to remove wifi settings from dietpi-config
# This will cause the root partition to resize / expand on next reboot
systemctl enable dietpi-fs_partition_resize

# Shutdown the system
shutdown -h now

Move SD Card

Next eject the SD card from the RPI.
Put in a different SD card with a linux operating system on and boot this.

The SD Card we've ejected is the one we're going to image.
Put the SD Card into a USB to SD card adapter then plug this into the Pi.

Generate Image

It's best to do this while root is mounted on a USB hard disk
Since we're creating and compressing some fairly big files

# Create the image
cd /home/dietpi
bash -c "$(curl -sSfL 'https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-imager')"
  • Select Drive as source (typically something like /dev/sdc)
  • Select the root volume on the drive (usually only one will show up which is the ext4 partition)
  • Select dd as cloning tool, DO NOT select Clonezilla installer, since this only works for x86_64 target systems
  • Give it a Name
  • Select Start
  • Wait a while