fdisk should be included out of the box on most linux distros. You can do something like:
sudo fdisk /dev/mmcblk1
(please make sure that mmcblk1 is the device with partition you want to resize - which is mmcblk1p5 according to attached screenshots). Fdisk prompt should appear. Please note that the changes to the partition table won’t be saved until submitted by the user using „w” option. And if you set something wrong, you can cancel all the changes using „q” option.
Anyway, input „p” and confirm with Enter to display the current partition table for the device. You should be interested in the entry for mmcblk1p5 as this is the rootfs partition which we want to resize. Entry should look similiar to:
/dev/mmcblk1p5 32768 123596799 123564032 58,9G 83 Linux
Please note down the sector number of the beginning of the partition (in my example it is 32768 - but in your case the number should be much larger; also in your case the size should be like 700M, not 58G…). As this is the last partition on the device (directly followed by an unallocated disk space), you most likely don’t have to care about where it ends currently.
Now delete this undersized partition using „d” and „5” (assuming mmcblk1p5 was the 5th partition!) and create new one using „n”. You will be asked some questions about it. When asked about the partition number, enter 5. When asked about the beginning of the partition, enter the starting sector number noted down in previous step
When asked about the end of the partition, just press enter so fdisk will use the last available sector, which in your case should be the very last sector on the device. Most likely you can answer with defaults (just pressing enter) for any other questions. After creating the partition, fdisk should automatically detect that it starts with the filesystem definition (as it starts in the exactly same place as the previous partition) and it will ask if to remove the „filesystem (most probably ext4) signature” - do NOT remove it - then all the data on the partition will be preserved.
After that, write the changes to device using „w”.
Now your mmcblk1p5 partition should be as large as the whole remaining space on the device.
Submit the changes to the kernel by issuing
and if you’ll receive errors saying that it cannot be done as the device is busy, reboot the system. Then, the changes should be visible after reboot (you can confirm by displaying the partition table with fdisk again and chcecking if mmcblk1p5 has the desired size).
However, the partition still contains the same undersized filesystem as before. So now we have to tell the filesystem to use whole available space of the partition. For ext filesystems it can be done via resize2fs command.
sudo resize2fs /dev/mmcblk1p5
Without additional args, it should resize the filesystem so it will use the whole avilable space on the partition - without affecting the current files.
You should be done now. make sure that the desired device (mmc memory) is mmcblk1 and desired partition is mmcblk1p5 - otherwise you should correct the commands accordingly. Please note that dealing with partition table in an improper way can and surely will lead to data loss, so take a backup first. I am not responsible for any damage caused by the above