auto-maximize a logical partition with ext3

auto-maximize a logical partition with ext3

guy keren choo at actcom.co.il
Sun Apr 3 19:33:51 IDT 2011


Ira Abramov wrote:
> Quoting Hetz Ben Hamo, from the post of Sun, 03 Apr:
>> Umm, last time I checked, resize2fs (which now supports ext4, at least in
>> Fedora) can resize to use all available space if you don't give it any
> 
> Maybe I should have been more verbose - I know how to resize the FS,
> it's a no brainer. the problem is resizing the partition to the max
> without having to find the media size, or at the very least figuring out
> what is the maximum size it's alowed to be set to.
> 
> I can get the info in sectors with fdisk -lu, then I could get, process
> and write back the partition table with sfdisk, but it is hard to get
> the right number of sections for the partitions. for instance, I have
> here a CF card of 1GB, it has 2001888 sectors, but if I use fdisk to
> create a partition with the default maximum size it ends at 2001855 - so
> is it a problem if I set the partition end to the end of the disk or how
> do I find out the number of sectors to leave out if it needs to land on
> the mysterious and anacronistic "cylinder boundery"?

if it is the last partition, how about using expect (or similar) to 
automate 'fidk' on the device (probably need to set a loop device on the 
image file first), delete the partition and re-create it? as far as i 
remember, when you create a partition via fdisk's interactive prompt, by 
default it suggest to use all the available extra space.

if it's a logical partition - you'll need to delete the underlying 
logical part as well, i assume.

--guy




More information about the Linux-il mailing list