how to calculate correct values for resize2fs

Jelle de Jong jelledejong at powercraft.nl
Thu Jun 25 19:28:29 UTC 2009


Christian Kujau wrote:
> On Tue, June 23, 2009 02:12, Jelle de Jong wrote:
>> I want to make a new 16 MB partition on the end of my /dev/sda SSD.
>> Currently the SSD is partitioned in one ext2 /dev/sda1.
>> My question is how can i make this new partition with the CLI tools.
> 
> Creating partitions is done with {c,s}fdisk. I think cfdisk ask where to 
> create this partition (at the end/at the beginning of the disk).
>  
>> I also have some parted question on how to just make a partition from
>> the free space on the end of the disk.
> 
> "man parted", but I guess if cfdisk can do it, parted should be able to do 
> so as well. Hm, I just checked:
> 
> (parted) help mkpart                                                      
>   mkpart PART-TYPE [FS-TYPE] START END     make a partition
> 
> So, you can actually specify where you want the partition to start.
> 
> 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.
> 
> C.

Thanks for the feedback, I seem to have made some mistakes in explaining
the situation. I am not really a newbie I know most of the fdisk and
parted tools almost out of my head.

The question is more about resizing partitions and changing disk
layouts. How to calculate with block sizes and get the wanted partition
sizes.

I show the details of my file system in my previous mail, what would be
the exact commands to to resize my /dev/sda1 partition and what would be
the exact command to create a additional partition that fits the new
created free space:

so:

resize2fs /dev/sda1 ????????

sudo /sbin/parted --script /dev/sda \
mkpart primary ?????? 100% \
print

fdisk /dev/sda
# enter 'm, t, 2, ef ,w'

Hope you can show me how to calculate the value to get a 16 MB free
space on /dev/sda with the resize2fs tool.

Best regards,

Jelle de Jong




More information about the Ext3-users mailing list