how to calculate correct values for resize2fs

Jelle de Jong jelledejong at powercraft.nl
Sat Jun 27 08:50:54 UTC 2009


Bodo Thiesen wrote:
> * Jelle de Jong <jelledejong at powercraft.nl> hat geschrieben:
> 
>> Christian Kujau wrote:
>>> After creating a new partition, you can mkfs this new one. I did not 
>>> understand at which point you want to "resize" a partition. Resizing a 
>>> filesystem is usually done on existing, resized partitions.
> 
> He wants to SHRINK the partition, so he will have to resize the
> file system, then shrink the partition.
> 
>> resize2fs /dev/sda1 ????????
> [...]
>> Hope you can show me how to calculate the value to get a 16 MB free
>> space on /dev/sda with the resize2fs tool.
> 
> Just resize the file system on sda1 to 3GB (or another value which leaves 
> enough space - just overcalculate here). Then make the partition smaller 
> to the final size you want it to be, then re-erlarge the file system to 
> it's final size.
> 
> And another advice: Do NOT create the new partition(s), before you 
> completed the TWO resize-steps.
> 
> Regards, Bodo

Hi Bodo thanks for the feedback,

The problem is I have to automate this process for a lot of systems. I
just want a good scientific explanation on how to calculated the needed
sizes for resize2fs if you look at my first post I attached a lot of
data that should provide enough info for a good exact calculation. I
just don't know how this calculation should be made.

Just shrinking the partition to 3GB is not an option because there is
not so much free space. There is around 200MB free space and I need a 16
MB new fresh partition. I can do this with gparted with 3 mouse clicks,
but i need a way to do it with commandline tools and I want to know how
to do the calculations.

Thanks in advance,

Jelle





More information about the Ext3-users mailing list