OpenWrt Forum Archive

Topic: Fix for "bad geometry: block count exceeds size of device" Mount Error

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I enlarged the root partition size using "make menuconfig."  However, when I try to mount the root partition, I get an error "bad geometry: block count exceeds size of device."

This tells me I need to change the partition table to match the new partition size is specified in "make menuconfig".

Where can I modify this?

Thank you,

Todd

(Last edited by bezenek on 30 Apr 2015, 21:53)

Additional information:

It looks like the "device" is defaulting to 102400 blocks, and does not increase when I change the size of the root partition past 100M in the configuration.  As a result, I see message like this in my log when I try to mount the root partition:

# For a 150M partition:
EXT4-fs (sda2): bad geometry: block count 153600 exceeds size of device (102400 blocks)

# For a 200M partition:
EXT4-fs (sda2): bad geometry: block count 204800 exceeds size of device (102400 blocks)

So, what/where is setting this arbitrary 102400-block device size?

-Todd

The fix for this is to force the partition table to be re-read.  This pulls in the correct partition size so it can then be mounted.

Partition size before partition table re-read:

> toddb@fidusb $ sudo blockdev --getsize64 /dev/sda2
> 104857600

The size is equivalent to 100 MiB.  It should be 150 MiB.

Then force the re-read and check the size again:

> toddb@fidusb $ s blockdev --rereadpt /dev/sda
> toddb@fidusb $ s blockdev --getsize64 /dev/sda2
> 157286400

This is the correct size of 150 MiB.

-Todd

p.s. I assume the original value is coming from the filesystem superblock.  This suggests a bug in genext2fs, but that's only a guess.

Please file a bug report for that.

- You should state what steps you took to hit that bug.
- State which version you compiled (BB or trunk)
- You should attach output of "./scripts/diffconfig.sh"

Since https://dev.openwrt.org/changeset/45517 there is no genext2fs in trunk so it might be a bug with the new way to create an image.

The discussion might have continued from here.