Add a pure sfdisk resizer for cc_growpart

Bug #1443689 reported by Adam Williamson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Expired
Low
Unassigned

Bug Description

The 'growpart' tool itself is actually replicating functionality sfdisk already has. When editing a partition, the size can be specified as '+' to indicate 'make this partition as large as possible'.

sfdisk < 2.26 would fail when attempting to do this on a GPT-labelled disk (which is a reasonable enough justification for growpart's existence, I guess), but from 2.26 onwards it works (in my testing, anyway) for both MBR- and GPT-labelled disks.

I've written a patch that introduces a new resizer (using cc_growpart's existing support for multiple resizer backends) which uses sfdisk directly instead of growpart. The new resizer is only considered to be 'available' if the util-linux version appears to be 2.26 or higher.

The effect should be that native sfdisk resizing will be used if util-linux is new enough, but growpart will be used if it's older.

I would envisage that at some point we could decide that everyone's had enough of a chance to update util-linux and growpart could shuffle off this mortal coil, and the code could probably then be substantially simplified.

I'm going to try and tag a launchpad branch which has the patch applied, hope I get it right, my first time trying this...

Revision history for this message
Scott Moser (smoser) wrote :

a couple bits of information on this:
 * currently 2.26 has that dump/restore alters partition table on some disks
   https://bugzilla.redhat.com/show_bug.cgi?id=1211405
 * sfdisk in 2.26 supports gpt disks also

Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Scott Moser (smoser) wrote :

added support for using sfdisk > 2.26 to growpart.
growpart can now resize gpt or dos/mbr with sfdisk.

Revision history for this message
James Falcon (falcojr) wrote :
Changed in cloud-init:
status: Confirmed → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.