Place old SD card into a Laptop with Card reader. Umount the Partitions:
umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
Copy the hole Disk to a local file. This takes some time
dd if=/dev/mmcblk0 of=/home/oliver/raspberry_backup.img bs=1M
Place the new larger SD Card into the Laptop. Umount the Partitions of new SD Card
umount /dev/mmcblk0p1
Copy the created Image to the new larer SD Card. This takes some time
dd if=/home/oliver/raspberry_backup.img of=/dev/mmcblk0 bs=1M
Place new SD Card into the raspberry pi. Check if the image boots up. then Start raspi-confi and choose expand disk in the menu.
sudo raspi-config
check if the new partion has the larger size
df -h
Source:
Last generation on 2025-01-18 00:00:29.