Closed ferguman closed 4 years ago
I wonder about this line in the script:
DATA_PART_SIZE=$(blockdev --getsize $DATA_PART_DEV)
- Isn't this calculating the size of the partition (and not the filesystem).
Should a command like the following be used:
sudo dumpe2fs -h /dev/mmcblk0p4
- This command accurately returned the information necessary to calculate the unused partition space on my test fopd system.
I added a initialize function to fopd that will resize the data partition. The resize function is idempotent so it can be run any time.
Use the initilization function for the time being
Mender images contain a service name resizefs (at /lib/systemd/system/resizefs.service) that is meant to check that the filesystem located on the data partition (e.g. /dev/mmcbk0p4) is sized to take up all the space available on the partition. This service is not working for the current fopd systems.
The service calls a shell script named resizefs.sh (ExecStart=/bin/sh -c 'sleep 1 ; /usr/sbin/resizefs.sh start').
I tested the commands contained in the service on a fopd where the /data filesystem was smaller than the size of its partition. The script was calculating that there was no free space for the file system to expand into.
Without understanding why the current script doesn't work I ask myself why can't one simply run resize2fs on the file system mounted at /data at the first time the mender image boots without bothering to do any calculations to determine whether it needs to be run or not? Won't resize2fs be doing the same calculations when it runs: