ssh – How to increase a partition on a Raspberry Pi without deleting the content?

Given the disk space on my Raspberry Pi was too small, I moved from a 32 GB SD card to a 128 GB SD card on my Raspberry Pi 5. Therefore, I cloned the old card to the new one using:

sudo dd if=/dev/mmcblk0 of=/dev/sda status=progress

However, I checked afterwards the partition sizes and saw that only about 32 out of 128 GB are usable. Here the output of lsblk:

auronzo@raspberry:~ $ sudo lsblk -m
NAME          SIZE OWNER GROUP MODE
mmcblk0     119.1G root  disk  brw-rw----
|-mmcblk0p1   512M root  disk  brw-rw----
`-mmcblk0p2  29.2G root  disk  brw-rw----

How can I increase the partition mmcblk0p2 (ideally to the max. size) without moving the content around?

Read more here: Source link