🛠 Exploiter les 32 Go d'eMMC d'un CM3+ après flash
Objectives
Raspberry Pi OS images are written "to the letter" (~2 GB): flashed onto the 8/16/32/64 GB eMMC of a CM3+, they leave most of the storage unallocated. This tutorial extends the root partition and file system to utilize the entire chip, then sets up trim (fstrim) to preserve the eMMC's lifespan — as no official endurance data is published by Raspberry Pi, we apply best practices. Note: The CM3+ Lite does not have an eMMC, so this tutorial does not apply to it.
Hardware
- CM3+ with eMMC (8 to 64 GB) on CMIO3, system already flashed and bootable
- Backup of important data before touching partitions
- HDMI screen or SSH access
Complete code
# 1. État initial : la racine est bien plus petite que le disque
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT # mmcblk0 ~32 Go, mmcblk0p2 ~2 Go
growpart /dev/mmcblk0 2 # étend la partition 2 jusqu'à la fin
sudo reboot
# 2. Étendre le système de fichiers (ext4)
sudo resize2fs /dev/mmcblk0p2
df -h / # la racine occupe désormais ~32 Go
# 3. Trim périodique pour la santé de l'eMMC
systemctl status fstrim.timer || sudo systemctl enable --now fstrim.timer
# 4. (Optionnel) Méthode tout-en-un via raspi-config :
sudo raspi-config --expand-rootfs && sudo reboot
Expected verification
After growpart + resize2fs (or raspi-config --expand-rootfs), df -h / displays a root of approximately 32 GB with several GB available. lsblk shows mmcblk0p2 at the disk size. systemctl list-timers | grep fstrim confirms the periodic trim execution.
Common errors
- Running growpart without sudo: the command fails silently or refuses; rerun with superuser privileges.
- Forgetting resize2fs after growpart: the partition is large but the file system remains at 2 GB —
dfdoes not change by a single byte. - Manipulating partitions without backup on a production module: growpart is safe in the simple case (last partition), but not if the scheme has been modified manually.
- Believing the CM3+ Lite is concerned: without eMMC, its storage is an external SD card on the SDX interface, to be sized on the carrier board side.
- Writing frantically in a loop to the eMMC (logs at 10 Hz): without an official published endurance figure, prefer journald in memory (Storage=volatile) for voluminous traces.
Other tutorials for this board
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash