Cloning a Disk Image
Creating a Headless Raspberry Pi Startup Disk © 2022 by Jon Webb is licensed under CC BY-SA 4.0
These steps have been tested using a Raspberry Pi 4.
The Raspberry Pi Imager software GUI can be used to download, copy, and modify disk images.
Raspberry Pi OS Lite (64-bit) image and the target storage device.
Select the advanced options icon (lower right) and adjust the following settings:
Write the image to the target storage device.
A headless setup can also be achieved by copying the image and modifying it manually.
As of 2022, the downloaded image uses the
xz compression format, so you’ll need the
unxz command to get the
img file (e.g.
FAT32 partition labeled
Mount the boot partition:
$ udisksctl mount -b /dev/sda1 $ cd /run/media/jon/boot
Ethernet should work out of the box, but WiFi can be configured by creating a
userconf.txt file can be used to configure a default user account.1
Creating a default user
jon with the password
$ echo "jon:$(echo 'raspberry' | openssl passwd -6 -stdin)" > userconf.txt
Enable SSH by creating an empty file called
ssh in the boot partition root.2
$ touch ssh
Finally, unmount the
$ cd $ umount /run/media/jon/boot
ext4 partition labeled
Mount the root partition:
$ udisksctl mount -b /dev/sda2 $ cd /run/media/jon/rootfs
Update the hostname in both
etc/hosts (the default is
Create a symlink from the time zone file to
$ sudo ln -sf usr/share/zoneinfo/America/New_York /etc/localtime
us, for example.
Unmount the boot (and root partition, if used):
$ cd $ umount /run/media/jon/boot $ umount /run/media/jon/rootfs
The startup disk should now be configured for headless use.
Raspberry Pi OS supports multicast DNS, which resolves to its hostname and the
Assuming a default user
jon and a hostname
$ ssh firstname.lastname@example.org