Device: Ubuntu 20.04.5 on Raspberry Pi 4B
I am willing to automatize the process of having a persistent data partition in a Azure Device Update scenario. For that (dual boot), I need a persistent data partition (so my partition table is <boot/rootfs1/rootfs2/data>). The image is created in an Azure Pipeline process, so the image only contains a partition table of few gigabytes. When the SD card on the Raspberry Pi 4B is flashed, a script runs at first boot to resize the partitions as followed:
Retrieve the free space (on the base image, all four partition goes to approx. 10Gb, but SD card is 32Gb minimum)
Calculate all the sectors to resize the partitions
Move them to their final offsets
Resize the partition
Resize file system
All of them are ext4 file systems, and in the image creation process everything goes well, folders are created in the persistent data creation, all of them indicate ext4 and everyone's happy. But during the resize process, and moving partitions with sfdisk, partitions lose their ext4 fstype, as if they were corrupted. Here is my command:
echo "+$data_sectors_to_move," | sfdisk /dev/mmcblk0 -N 4 -f --no-reread
I used to add the --move-data parameter but for the past few days it has been giving me the error
sfdisk: /dev/mmcblk0p4: failed to move data: Not a directory
Now where I don't move the data, it just looses the ext4 format.
I tried to execute mkfs.ext4, but after the automatic process execution and device's reboot, still no ext4 indication when executing parted /dev/mmcblk0 --script print.
No error is given in the logs. Please note that i cannot post my code, but i'll be happy to answer your questions.
Was expecting partitions to be moved and resized, keeping the data on them and their fs type, but none happened.