Eric Sandeen <sandeen@xxxxxxxxxx> writes: > On 4/30/12 12:19 PM, Daniel Drake wrote: >> Hi, >> >> OLPC has started using ext4 online resizing to grow our filesystems to >> use the whole SD card on first boot - something we never did before. >> Working very nicely, thanks! >> >> I'm trying to simplify/improve the scripts involved in doing this. >> >> How can I programatically check if an ext4 fs already fills its >> partition, or if it has room to grow? >> >> >> The numbers produced by dumpe2fs (e.g. block count) or "df" don't seem >> to exactly line up with the sizes produced by fdisk. > > Do you have an example of this? > > For starters, use fdisk -u to get 512-byte sector units, > otherwise it's just inscrutable CHS magic. Note that fdisk -u gives sector units, which may or may not be 512 bytes: $ sudo fdisk -lu /dev/sdb Note: sector size is 4096 (not 512) Disk /dev/sdb: 300.1 GB, 300069052416 bytes 255 heads, 63 sectors/track, 4560 cylinders, total 73259046 sectors Units = sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x00000000 Cheers, Jeff -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html