Rootfs.img - save eMMC content and put it back into the SD installation card or other installation methods?


Recently I opened this thread to asking how to get the content of the eMMC memory.
The solution in that thread can be very time consuming…

It would be interesting to save the rootfs content (which is stored into /dev/mmcblk0p10) into another rootfs.img file to replace the original rootfs image file into the OS partition of the SD installation card.
The first problem I see is that fs sizes can give problem, since if rootfs.img is too big, it wont fit into the OS partition of the SD installation card…

Perhaps the best way would be building an SD from scratch with 2 partitions: one FAT containing the u-boot partition and the other one containing the rootfs content, all to be flashed into the non volatile memory.

Since the original installation SD have 9 partitions (here are the output of fdisk -l):

Disk /dev/sdb: 7.2 GiB, 7744782336 bytes, 15126528 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: 0FA49CC5-A200-4750-8FD6-80D6E3DF5CF6

Device       Start     End Sectors  Size Type
/dev/sdb1       34    1057    1024  512K unknown
/dev/sdb2     1058    2081    1024  512K unknown
/dev/sdb3     2082    4129    2048    1M unknown
/dev/sdb4     4130    5153    1024  512K unknown
/dev/sdb5     5154    5185      32   16K unknown
/dev/sdb6     5186    7233    2048    1M unknown
/dev/sdb7     7234  138305  131072   64M unknown
/dev/sdb8   138306 2235457 2097152    1G Linux filesystem
/dev/sdb9  2235458 7921630 5686173  2.7G Linux filesystem

I have some doubt about doing it with just 2 partitions…
What are your suggestions ?

Thank you in advance.


you can’t have just 2 partitions. all the ‘unknown’ partitions in your listing are required to boot from SD card, and cannot be changed. sdb8 is the rootfs that contains the installer software and sdb9 is the ‘OS’ partition that contains the images to flash.

You can flash the SD install image onto a large SD card, and then you can use linux tools to resize the OS partition to be bigger. Would that work for you?

Hello @ndec,

I finally manage ti putting the whole mmcblk0 into an img file and compress it with gzip, all from the developer image, saving the destination img into a USB with enough space.

Thank you.