Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Over-allocating blocks during mkfs #72

Open
lungj opened this issue Mar 8, 2023 · 1 comment
Open

Bug: Over-allocating blocks during mkfs #72

lungj opened this issue Mar 8, 2023 · 1 comment

Comments

@lungj
Copy link

lungj commented Mar 8, 2023

Summary

When running ext4_mkfs, lwext4 may mark more blocks as free than can actually fit on the device.

Reproducing

make
cd build_generic/fs_test
make
dd if=/dev/zero of=lwext_image bs=1000000 count=200
./lwext4-mkfs -v -i lwext_image -e 4 -b 4096
./lwext4-generic -i lwext_image --sbstat

Actual output shows

blocks_count = 48828
free_blocks_count = 61172
block_size = 4096
block_group_count = 2

Free blocks * block size is over 250MB. The device is only 200MB. The larger the block size, the more the formatted capacity might exceed the physical capacity.

Expected

Whereas with the standard mkfs command on Linux:

dd if=/dev/zero of=ext_image bs=1000000 count=200
mkfs -t ext4 -b 4096 ext_image

We get

blocks_count = 48828
free_blocks_count = 40583
block_size = 4096
block_group_count = 2

Free blocks * block size is about 166B. This fits in the 200MB device.

@kevin-gk
Copy link

It's real a bug. Is there a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants