auto-maximize a logical partition with ext3

auto-maximize a logical partition with ext3

Amos Shapira amos.shapira at gmail.com
Thu Apr 7 08:13:22 IDT 2011


If I understand your question then you want to treat a disk image stored
inside a none-disk (e.g. a Logical Volume or even a regular file) as a
physical disk and access the partition inside it.

In that case "kaprtx" is your friend, something like:

losetup -f /dev/vgname/lvname
kpartx -a -v /dev/loopN

now you can access the partitions inside it (e.g. "vgchange -ay
internal-vgname", "mount", "resizefs" etc)

to reverse:

umount/vgchange -an/...
losetup -a # to find which loop device you need to deactivate
kpartx -d /dev/loopN
losetup -d /dev/loopN

Did I get it?

--Amos

On 3 April 2011 03:43, Ira Abramov <Lists-Linux-IL at ira.abramov.org> wrote:

> Hello friends, last resort before I go and reinvent the wheel, badly.
>
> I have a system here that creates a dozen images for medias of different
> sizes, installing a few dozen machines every day. I would like to make
> the process more unified - install the same 4G image on all medias (dd)
> and then maximize sda6, the last ext3 partition, and naturally, the
> underlying extended partition sda4.
>
> The only tool that automates resizing like that is parted, and it still
> needs a precise partition length instead of "use all available space",
> and won't resize ext3 if I don't turn off the journaling first (make it
> ext2). I tried deducing the maximum partition size with fdisk -l and
> other sfdisk instead, but each uses different units and I have no idea
> how to convert them all correctly so I'm left with working, non
> overlapping partitions.
>
> I'm prepared to do it the hard way, I just wondered if there's a tool I
> missed or an existing script that already does this.
>
> Thanks.
>
> --
> His own worst enemy
> Ira Abramov
> http://ira.abramov.org/email/
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20110406/29d9dd5b/attachment.html>


More information about the Linux-il mailing list