cloud-init's growfs/resize fails with gpart dependency on FreeBSD
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Undecided
|
Harm Weites |
Bug Description
I've generated a FreeBSD qcow2 including base and kernel with cloud-init and dependencies. cloud-init runs when the instance boots, but the growpart module fails due to, what appears to be, two separate problems.
One of the dependencies is the gpart port/pkg which, incidentally, is a reason it is failing[1]. The growpart module, for a yet unknown reason, is calling /usr/local/
cloud-init executes growfs, via resizefs, after successful execution of gpart recover/resize. The logs[2] illustrate the growfs command as growfs /dev/vtbd0p2. By default, FreeBSD's growfs runs interactively asking a question which can be mitigated using the '-y' command line option. The logs indicate a successful growfs operation, but df doesn't reflect it. I suspect the this is due to the default interactive nature of growfs.
[1] http://
[2] http://
Related branches
- Bert JW Regeer (community): Approve
- Scott Moser: Pending requested
-
Diff: 24 lines (+1/-2)2 files modifiedcloudinit/config/cc_resizefs.py (+1/-1)
tools/build-on-freebsd (+0/-1)
- Chad Smith: Approve
- Server Team CI bot: Approve (continuous-integration)
- Harm Weites: Pending requested
-
Diff: 26 lines (+2/-2)2 files modifiedcloudinit/config/cc_resizefs.py (+1/-1)
tests/unittests/test_handler/test_handler_resizefs.py (+1/-1)
Changed in cloud-init: | |
status: | New → Confirmed |
assignee: | nobody → Harm Weites (harmw) |
Interested to see this from gpart:
2015-01-11 18:49:23,742 - util.py[DEBUG]: Failed: gpart recover /dev/vtbd0 lib/python2. 7/site- packages/ cloudinit/ config/ cc_growpart. py", line 132, in resize subp([" gpart", "recover", diskdev]) lib/python2. 7/site- packages/ cloudinit/ util.py" , line 1570, in subp nError: Unexpected error while running command. -c][-d] [-E][-e] [-f][-g] [-h][-i] \n [-K <last sector>][-k <# of sectors>][-L][-l <log file>]\n [-n <increment>][-q][-s <sector-size>][-t <module-name>]\n [-V][-v][-W <device>][-w <module- name,weight> ]\ngpart v0.1h (c) 1999-2001 Michail Brzitwa <email address hidden>.\nGuess PC-type hard disk partitions.\n\n'
Traceback (most recent call last):
File "/usr/local/
util.
File "/usr/local/
cmd=args)
ProcessExecutio
Command: ['gpart', 'recover', '/dev/vtbd0']
Exit code: 1
Reason: -
Stdout: ''
Stderr: 'Usage: gpart [options] device\nOptions: [-b <backup MBR>][-C c,h,s][
This was stderr:
Usage: gpart [options] device -c][-d] [-E][-e] [-f][-g] [-h][-i]
[-V][ -v][-W <device>][-w <module- name,weight> ]
Options: [-b <backup MBR>][-C c,h,s][
[-K <last sector>][-k <# of sectors>][-L][-l <log file>]
[-n <increment>][-q][-s <sector-size>][-t <module-name>]
gpart v0.1h (c) 1999-2001 Michail Brzitwa <email address hidden>.
Guess PC-type hard disk partitions.
A little rude, but lets see what happens, since the above is most certainly nothing compared with man gpart...
# find / -name gpart sbin/gpart
/rescue/gpart
/usr/local/
/sbin/gpart
Bingo: we have gpart in base -and- from ports, and according the initscript cloudinit will use /usr/local/sbin first.
Workaround:
After installing the cloudinit port remove gpart: pkg delete -f gpart
Fix:
Lets remove that port from the required dependencies. Ill see what's required to get that going, I think this only involves pushing out a new port release.
The other issue seems to be with growfs, which doesn't grow the filesystem. The cc_resizefs module should be looking like this:
def _resize_ ufs(mount_ point, devpth):
return ('growfs', '-y', devpth)
After this it'll resize as planned. (I can't believe I missed that -y though...)