Raspberry Pi SSD/SD Card Image Manager (sdm)
Introduction
The Raspberry Pi SSD/SD Card Image Manager (sdm) is a powerful command-line tool that simplifies the process of creating consistent, ready-to-use SSDs and SD cards for Raspberry Pi systems.
With sdm, you can easily build customised images that include your preferred packages, configurations, and personal customizations, making it ideal for:
Maintaining consistency across multiple Raspberry Pi systems
Quickly rebuilding Raspberry Pi systems with pre-installed packages and customizations
Streamlining the setup process when new releases of Raspberry Pi OS become available
Efficiently creating and distributing customized images for Raspberry Pi projects
Features
sdm offers a wide range of features to help you create tailored Raspberry Pi images:
Customization of system settings, such as keyboard mapping, locale, timezone, and Wi-Fi country
Installation of additional packages and applications
Configuration of VNC (RealVNC, TightVNC, or TigerVNC) for remote access
Setup of access points (hotspots) in various modes (local, routed, or bridged)
Enabling of Pi-specific devices, such as camera and I2C
Integration of personal customizations through plugins
Appending custom fstab entries to /etc/fstab
Disabling complex functions like Bluetooth, piwiz, swap, triggerhappy, and Wi-Fi
Configuration and management of systemd services
Burning customized images for network distribution
Updating existing Raspberry Pi SD cards or SSDs using the --explore command
Installation
To install sdm, run the following command in your terminal:
This will download the necessary files to /usr/local/sdm
and create a symlink for sdm in /usr/local/bin
for easy access.
Usage
Customising an Image
To customise a Raspberry Pi OS image with sdm, use the following command:
This command will:
Copy localisation settings (keymap, locale, timezone, and Wi-Fi country) from the host system
Configure SSH to be enabled
Create a specified user with the given password and enable sudo for that user
Perform an
apt update
andapt upgrade
Prevent piwiz from running and regenerate SSH host keys after system time synchronization on first boot
Burning an Image to an SD Card
To burn a customized image to an SD card, use the following command:
This command will burn the image to the SD card at /dev/sde
, set the hostname to mypi1
, and expand the root filesystem after the burn is complete.
Plugins
sdm supports various plugins to extend its functionality:
apps
: Install additional packages and applicationsVNC
: Install and configure VNC (RealVNC, TightVNC, or TigerVNC)raspiconfig
: Enable Pi-specific devices, such as camera and I2Csystem
: Append custom fstab entries and manage systemd services
You can create your own plugins by copying and modifying the sdm-plugin-example
skeleton plugin. See the "Programming Plugins" section in the documentation for more details.
Exploring an SD Card or SSD
To update an existing Raspberry Pi SD card or SSD, use the --explore
command:
This command will allow you to nspawn into the SD card or SSD and perform system management tasks, such as changing account passwords or installing additional packages.
Documentation
For complete documentation on sdm, refer to the online documentation. You can also watch sdm in action here (note: the video is slightly outdated and doesn't use plugins, but it provides a good overview of how sdm works).
Conclusion
sdm is a versatile tool that streamlines the process of creating and managing Raspberry Pi images.
By leveraging its features and plugins, you can save time and effort in setting up and maintaining your Raspberry Pi systems, allowing you to focus on your projects and goals.
Last updated
Was this helpful?