growpart not working on regular files

Bug #1007415 reported by Scott Moser
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-utils (Ubuntu)
Fix Released
Low
Scott Moser

Bug Description

$ truncate --size 1G my.img
$ echo "1,," | sfdisk my.img
$ fdisk -l my.img

Disk my.img: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

 Device Boot Start End Blocks Id System
my.img1 16065 2088449 1036192+ 83 Linux

# this is right, it can't be grown yet.
$ growpart --dry-run my.img 1
NOCHANGE: partition 1 is size 2072385. it cannot be grown

$ truncate --size 4G my.img

$ growpart --dry-run my.img 1
CHANGE: partition=1 start=16065 old: size=2072385 end=2088450 new: size=8369865,end=8385930
# === old sfdisk -d ===
# partition table of my.img
unit: sectors

  my.img1 : start= 16065, size= 2072385, Id=83
  my.img2 : start= 0, size= 0, Id= 0
  my.img3 : start= 0, size= 0, Id= 0
  my.img4 : start= 0, size= 0, Id= 0
# === new sfdisk -d ===
# partition table of my.img
unit: sectors

  my.img1 : start= 16065, size= 2072385, Id=83
  my.img2 : start= 0, size= 0, Id= 0
  my.img3 : start= 0, size= 0, Id= 0
  my.img4 : start= 0, size= 0, Id= 0

As shown above, it thinks it should change it, and actually even thinks it did, but it does not.

The issue here is that the change made in 'old' to 'new' is expecting '<file>1' to be at the beginning of the line, as it is when file is a device. But here, it is padded by some white space.

a simple work around is to give a full path to the file, which will end up using that white space and making it work.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: cloud-utils 0.25-0ubuntu5
ProcVersionSignature: User Name 3.2.0-23.36-virtual 3.2.14
Uname: Linux 3.2.0-23-virtual x86_64
ApportVersion: 2.0.1-0ubuntu5
Architecture: amd64
Date: Fri Jun 1 13:16:49 2012
Ec2AMI: ami-000000bf
Ec2AMIManifest: FIXME
Ec2AvailabilityZone: nova
Ec2InstanceType: m1.small
Ec2Kernel: unavailable
Ec2Ramdisk: unavailable
PackageArchitecture: all
ProcEnviron:
 TERM=screen
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: cloud-utils
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Scott Moser (smoser) wrote :
description: updated
Changed in cloud-utils (Ubuntu):
status: New → Triaged
assignee: nobody → Scott Moser (smoser)
importance: Undecided → Low
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-utils - 0.26-0ubuntu2

---------------
cloud-utils (0.26-0ubuntu2) raring; urgency=low

  * debian/copyright: fix formatting
  * sync to trunk at revno 216
    * support for GPT partitions in growpart via sgdisk (LP: #1087526)
    * depend on wget and ca-certificates for ubuntu-cloudimg-query
      (LP: #1062671)
    * fix sfdisk parsing (LP: #1007415)
 -- Scott Moser <email address hidden> Mon, 04 Feb 2013 15:18:49 -0500

Changed in cloud-utils (Ubuntu):
status: Triaged → Fix Released
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.