Expanding emmc file system

Hi,
I am trying to install rockpi4b-ubuntu-bionic-minimal-20190104_2101-gpt.img into the emmc module. I have succeeded for the the most part, but I am having a problem when trying to expand the emmc file system. I have done an extensive google search and tried so many suggestion for the internet. expanding does work but I no longer can boot from the emmc module. I am not sure what I am missing.
for the most part the step I take are as following:

I use etcher to write the image into a 16G SD card, and boot from the SD, then I run the following commands:

dd if=/dev/mmcblk0 of=/dev/mmcblk1 bs=4M conv=sync,noerror
sudo mount /dev/mmcblk1p5
sudo nano /mnt/etc/fstab

I change the line there to read:

/dev/mmcblk1p4 /boot vfat defaults 0 2

Then I use parted to fix the emmc

sudo patred /dev/mmcblk1
(parted) p
Warning: Not all of the space available to /dev/mmcblk1 appears to be used, you can fix the GPT to use all of the space (an extra 89715712 blocks) or continue with the current setting?

I answer Fix, then

sudo resize2fs /dev/mmcblk1p5

then use fdisk

sudo fdisk /dev/mmcblk1

There i will delete partition 5 and create using the full space maintaining the first sector, and write.
then reboot.
no joy, it wont boot. If I skip all the size fixing and reboot after the dd command and modifying the fstab file, it will boot normally and I can use it without any issue.

Any help is appreciated. as the last option I see is buy a 64G SD to match the MMC size and repeat without the need to resize, but I do not really want to waste the money on that.

My current eMMC shows the following using parted:

Model: MMC SLD64G (sd/mmc)
Disk /dev/mmcblk1: 61.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
 
Number  Start   End     Size    File system  Name     Flags
 1      32.8kB  4129kB  4096kB               loader1
 2      8389kB  12.6MB  4194kB               loader2
 3      12.6MB  16.8MB  4194kB               trust
 4      16.8MB  134MB   117MB   fat16        boot     boot, esp
 5      134MB   15.9GB  15.8GB  ext4         rootfs

and using fdisk:

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (31116287 != 120831999) will be corrected by w(rite).
GPT PMBR size mismatch (31116287 != 120831999) will be corrected by w(rite).

Command (m for help): p

Disk /dev/mmcblk1: 57.6 GiB, 61865984000 bytes, 120832000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 992DF2C2-0170-4F66-9492-FBF320673EEF

    Device          Start      End  Sectors  Size Type
    /dev/mmcblk1p1     64     8063     8000  3.9M Linux filesystem
    /dev/mmcblk1p2  16384    24575     8192    4M Linux filesystem
    /dev/mmcblk1p3  24576    32767     8192    4M Linux filesystem
    /dev/mmcblk1p4  32768   262143   229376  112M EFI System
    /dev/mmcblk1p5 262144 31116254 30854111 14.7G Linux filesystem

You can not resize a mounted partition easiest is prob to just put it into a linux machine and use gparted or create a boot script to umount root then resize then reboot

PS sudo resize2fs /dev/mmcblk1p5 sudo not resize2fs /dev/mmcblk1

I tried both. After dd and before booting so there is no mount, and after booting from the eMMC, still it failed.

you are correct, the resize2fs is just typo when posting (corrected).

Did you use etcher? As this is a long shot but something isnt right.
If I use etcher in windows the fat partition is not recognised in windows.
I edited /extconfig/extconfig.conf and the whole folder became corrupt.

I haven’t checked what it was but fired off windows and etcher and created with
gunzip -c rockpi4b-ubuntu-bionic-minimal-20190104_2101-gpt.img.gz | dd of=/dev/sda

I meant to check if the image supplied is 100%

I did use Etcher, and I doubt it is related to that as the SD card boot and even the image taken to the eMMC works without any changes.

It did for me until I tried to edit it.

replying to my own post with the solution. I found this post which explain how to use the emmc without the adapter for anyone with similar situation:

1 Like