Context
I have a 500GB external SSD whith a 32 GB partition containing an older 32-bit Raspberry Pi OS, a boot partition of a few GB and a 468-ish GB partition for data (docker volumes, photos, generic data, etc...).
I want to move to a 64-bit OS, so I thought I would install the 64-bit Raspberry Pi OS on the 32 GB partition. However, I soon found that Raspberry Pi Imager and Balena Etcher can only install the image OS onto a whole device (removing any existing partitions) and not on a single partition.
While I do have a backup of what is on the 468 GB partition, it would be a recovery over a slow network so that's why I am not eager to simply overwrite everything and do a restore later.
Question
How can I flash the 64-bit Raspberry Pi OS onto a single partition of a large, multi-partition external SSD drive, preserving any other partitions?
What I've tried
I found this similar question/answer, but the answer seems to suggest this is simply not possible.
I found that one can use the
dd
command to copy the image onto a device. I tried this with (/dev/disk2s2
is the target partition):sudo dd if=2023-02-21-raspios-bullseye-arm64-lite.img of=/dev/disk2s2 bs=4M conv=fsync status=progress
This produced no error, but the 32 GB partition became unmountable (I received an error when mounting: "wrong fs type, bad option, bad superblock").