← Back to team overview

cloud-init-dev team mailing list archive

Re: Resizing of a GPT partition


On Tue, 1 May 2012, Haefliger, Juerg wrote:

> Hi all,
> I've fiddled around with cc_resizefs.py trying to resize a GPT root
> partition (2nd partition) but I can't get it to work. Any ideas how to
> do that? Is it possible at all?

Its not configurable at the moment.  Thats not to say that it couldn't be,
but the code as it is right now just attempt to resize the device that '/'
is on.

It just does:
    st_dev = os.stat("/").st_dev
    dev = os.makedev(os.major(st_dev), os.minor(st_dev))
    os.mknod(devpth, 0400 | stat.S_IFBLK, dev)

    cmd = ['blkid', '-c', '/dev/null', '-sTYPE', '-ovalue', devpth]

So whatever dev major and minor / is on it should attempt to resize.

It just gets the device by os.stat("/") because that was the most reliable
way I could think to get the device name of /, independent of root=.

Follow ups