Moved a Pi system off microSD onto NVMe
I moved my Raspberry Pi 5 system from microSD to a Compute Module 5 with NVMe because I worried about constant writes wearing out the card. It boots from NVMe with the copied files and permissions intact.
Results
36.8 GBof system and files carried over
238 GiBusable NVMe, root grown to fill it
The problem
A plain disk clone made in a Windows partition tool would not boot. Copying files over with rsync left a drive that stopped at an initramfs prompt, then at a blinking cursor, and a recursive ownership change along the way broke sudo.
What I did
- Traced a missing microSD to a faulty USB card reader before touching any software.
- Copied the boot and root partitions with rsync, keeping permissions and extended attributes, and checked the result with diff.
- Fixed sudo after a recursive chown stripped its setuid bit, by restoring root ownership and mode 4755 from a second system.
- Cloned the whole card from a fresh Pi OS install, then grew the root partition with fdisk to fill the NVMe drive.
What I took from it
The file-by-file copies failed to boot, and one ownership change broke sudo. A full clone followed by growing the root partition finally booted with the files and permissions intact.