cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I've exported our custom root filesystem from a running board with the following command: dd if=/dev/mmcblk1p4 of=/usr/local/rtfs.ext4 bs=1M conv=fdatasync

Lmoio.1
Senior

I noticed that after I flash the ST starter package root filesystem, at first boot there is a check on bad blocks and a resize of the partitions, while when I flash the exported root filesystem, there is no checks and some partitions are not resized to the full size.

For instance, when doing df, i get:

Filesystem     1K-blocks   Used Available Use% Mounted on
devtmpfs          377684      0    377684   0% /dev
/dev/mmcblk1p4    703328 498552    155760  77% /
tmpfs             445508      0    445508   0% /dev/shm
tmpfs             445508  17300    428208   4% /run
tmpfs             445508      0    445508   0% /sys/fs/cgroup
tmpfs             445508     12    445496   1% /tmp
/dev/mmcblk1p2     59365  30635     24144  56% /boot
/dev/mmcblk1p3     14839   6900      6793  51% /vendor
tmpfs             445508     20    445488   1% /var/volatile
/dev/mmcblk1p5    122835   4084    109577   4% /usr/local
tmpfs              89100      0     89100   0% /run/user/0

But /usr/local should be 2.9G.

Thank you for any help.

Lidia

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Lmoio.1​ ,

In fact there are 2 steps:

- First one in initrd: will resize at least the file systems required to get user space up and running (Bootfs, rootfs, ...).

see: ./meta-st-openstlinux/recipes-st/initrd/files/init-resize.sh

- Second one in systemd: will resize the rest (if required) when user land is there.

see: ./meta-st-openstlinux/recipes-bsp/tools/resize-helper/

On the board, you can find the service /lib/systemd/system/resize-helper.service that runs the /sbin/resize-helper

This shell disables the systemd to be made only one time and it uses the command resize2fs to resize the partitions.

Hope it helps,

Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
Kevin HUBER
ST Employee

Hello @Lmoio.1​ ,

If I understand correctly, your question is: why you do not have the same behavior if you flash the Starter Package or if you flash the rtfs.ext4, that you previously got from your board with dd?

I don't know why you are talking about "bad blocks", but from what I know, when you flash the Starter package and especially the Starter Package rootfs, this one is compressed.

During the first boot, the board is long to boot in particular because of the extraction of the rootfs.

If you use dd to get a copy of the rootfs ext4 from your board, the rootfs that you got will be already uncompressed.

So it's size is bigger than the one from the ST Starter Package and it will not need to be uncompressed during the first boot, so you do not have the same behavior.

Hope it helps,

Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi,

what I see the first time after flashing the starter package is this:

EXT4-fs (mmcblk1p4): mounted filesystem with ordered data mode. O
RESIZE VENDORFS [/dev/mmcblk1p3]
e2fsck 1.45.4 (23-Sep-2019)
Checking for bad blocks (read-only test): done
vendorfs: Updating bad block inode.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
 
vendorfs: ***** FILE SYSTEM WAS MODIFIED *****
vendorfs: 33/4096 files (0.0% non-contiguous), 8445/16384 blocks
resize2fs 1.45.4 (23-Sep-2019)
The filesystem is already 16384 (1k) blocks long.  Nothing to do!
 
RESIZE[    6.614880] EXT4-fs (mmcblk1p4): resizing filesystem from 147006 to 190
 ROOTFS [/dev/mmcblk1p4]
resize2fs 1.45.4 (23-Sep-2019)
Filesystem at /dev/mmcblk1p4 is mounted on /rootfs; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
[    7.147425] EXT4-fs (mmcblk1p4): resized filesystem to 190976
The filesystem on /dev/mmcblk1p4 is now 190976 (4k) blocks long.
 
RESIZE USERFS [/dev/mmcblk1p5]
e2fsck 1.45.4 (23-Sep-2019)
Checking for bad blocks (read-only test): done
userfs: Updating bad block inode.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
 
userfs: ***** FILE SYSTEM WAS MODIFIED *****
userfs: 368/32768 files (0.0% non-contiguous), 12313/131072 blocks
resize2fs 1.45.4 (23-Sep-2019)
Resizing the filesystem on /dev/mmcblk1p5 to 3015680 (1k) blocks.
The filesystem on /dev/mmcblk1p5 is now 3015680 (1k) blocks long.

It checks all the fs, not only rootfs. But the file I change is only rootfs. So the question is: is there a flag that tell the kernel to perform some kind of checks on all the fs during mounting?

Thanks

Hello @Lmoio.1​ ,

The ext4 partitions allows to flash only the size of the data used.

So ST delivery creates at build time the minimum size of the partition and a service is enabled in systemd to resize the data to the physical size of the partition at first boot.

Using dd tool, you will flash the complete partition (even area that are empty) so you we loose flash time, but save boot time because you will not have to resize the partition.

Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello @Kevin HUBER​ ,

Can you name the systemd service that you mention?

thank you

Lidia

Hello @Lmoio.1​ ,

In fact there are 2 steps:

- First one in initrd: will resize at least the file systems required to get user space up and running (Bootfs, rootfs, ...).

see: ./meta-st-openstlinux/recipes-st/initrd/files/init-resize.sh

- Second one in systemd: will resize the rest (if required) when user land is there.

see: ./meta-st-openstlinux/recipes-bsp/tools/resize-helper/

On the board, you can find the service /lib/systemd/system/resize-helper.service that runs the /sbin/resize-helper

This shell disables the systemd to be made only one time and it uses the command resize2fs to resize the partitions.

Hope it helps,

Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.