Work Home lab & side projects

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.

Raspberry Pi Compute Module 5
Raspberry Pi Compute Module 5 Photo: SparkFun Electronics, CC BY 2.0

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.
Four attempts to move the system to NVMe Attempt one, a disk clone from a Windows partition tool, would not boot. Attempt two, an rsync file copy, stopped at an initramfs prompt. Attempt three, after fixing sudo and the partition IDs, stopped at a blinking cursor. Attempt four, a full clone of the card followed by growing the root partition, booted from the NVMe drive. try 1 Disk clone would not boot try 2 rsync copy initramfs prompt try 3 Fix sudo, IDs blinking cursor try 4 Clone + grow boots from NVMe The fourth try booted
Four tries at moving the system. Only the full clone booted.

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.

Privacy