Calculate minimum ext3 partition size for certain amount of data
- by Daniel Beck
These following ext3 partitions contain identical data. As we can see, the larger the partition size, the more space is required for the same files:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop11 3965777 561064 3199964 15% [...]
/dev/loop19 573029 543843 29186 95% [...]
Filesystem Size Used Avail Use% Mounted on
/dev/loop11 3.8G 548M 3.1G 15% [...]
/dev/loop19 560M 532M 29M 95% [...]
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/loop11 1024000 1656 1022344 1% [...]
/dev/loop19 1024000 1656 1022344 1% [...]
I start with a partition of fixed size that possibly wasted a lot of space and I want to create a partition that is able to hold that data but with (almost) minimal size. How can I reliably calculate that minimal partition size needed for storing a certain amount of data? The amount of data changes over time, and I need to automate these calculations.