growpart on disk larger than 2TB fails
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | cloud-utils |
Medium
|
Scott Moser | ||
| | cloud-utils (Ubuntu) |
Medium
|
Scott Moser | ||
| | Precise |
Medium
|
Scott Moser | ||
| | Saucy |
Medium
|
Scott Moser | ||
Bug Description
=== Begin SRU Information ===
[Impact]
If growpart is run on a disk that is larger than 2 Terabytes and an MBR
partition table, then the partition table will not be updated correctly.
The result is that the partition can actually be shrunk, which breaks the
filesystem on the disk.
[Test Case]
To test, you need a block device > 2TB or a file > 2TB.
Because of sparse files, you can easily create one on local filesystem.
Below, an actual block device can be used just as well.
## Create a file that is 2.5TB.
$ dev="/tmp/my.img"
$ truncate --size 2500G $dev
## if 'dev' is a file, then 'update' wont work. In upstream trunk it will
## not attempt to run partx on a file. update only exists in saucy or later.
[ -b "$dev" -a "$(lsb_release -sc)" != "precise" ] &&
update_
## upstream cloud-utils, but broken
## use sfdisk to partition it with a 500GB first partition
## then show that that generally worked
$ echo "2048,$
$ sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/tmp/my.img1 2048 1048578047 1048576000 83 Linux
## use growpart to grow the partition
## then verify it worked. We should see a ~2TB partition size
$ growpart ${update_f} /tmp/my.img 1
CHANGED: partition=1 start=2048 old: size=1048576000 end=1048578048 new: size=4294965248
$ sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/tmp/my.img1 2048 4294967295 4294965248 83 Linux
## When this failed, it would fail like this:
## the new 'size' is > 2TB and thus invalid. And sfdisk -l would show
## the bad table.
$ growpart ${update_f} /tmp/my.img 1
CHANGED: partition=1 start=2048 old: size=1048576000 end=1048578048 new: size=5242874962
$ sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/tmp/my.img1 2048 947909713 947907666 83 Linux
[Regression Potential]
Regression potential is little to none.
This was 100% broken with disks over 2TB previously.
The code now checks if the new size would be greater than 2TB. If it is, it
just limits the size to 2TB.
=== End SRU Information ===
For disks larger than 2TB (the amount addressable by MBR), growpart will mess up partition tables.
It also fails in such a way that it ends up shrinking the partition table, see below for an example.
In reality, this is probably an sfdisk bug, but I can work around it in growpart by just knowing the max size.
$ sudo growpart -v --dry-run /dev/sdb 1
geometry is -C 364801 -H 255 -S 63. total size=5860528065
max_end=5860528065 tot=5860528065 pt_end=209715200 pt_start=2048 pt_size=209713152
CHANGE: partition=1 start=2048 old: size=209713152 end=209715200 new: size=5860526017
# === old sfdisk -d ===
# partition table of /dev/sdb
unit: sectors
/dev/sdb1 : start= 2048, size=209713152, Id=83, bootable
/dev/sdb2 : start= 0, size= 0, Id= 0
/dev/sdb3 : start= 0, size= 0, Id= 0
/dev/sdb4 : start= 0, size= 0, Id= 0
# === new sfdisk -d ===
# partition table of /dev/sdb
unit: sectors
/dev/sdb1 : start= 2048, size=5860526017, Id=83, bootable
/dev/sdb2 : start= 0, size= 0, Id= 0
/dev/sdb3 : start= 0, size= 0, Id= 0
/dev/sdb4 : start= 0, size= 0, Id= 0
$ sudo growpart /dev/sdb 1
CHANGED: partition=1 start=2048 old: size=209713152 end=209715200 new: size=5860526017
$ grep "sdb" /proc/partitions
8 16 2930266584 sdb
8 17 782779360 sdb1
$ sudo sfdisk -l /dev/sdb -u -S
unrecognized format - using sectors
Disk /dev/sdb: 364801 cylinders, 255 heads, 63 sectors/track
Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/sdb1 * 2048 1565560768 1565558721 83 Linux
/dev/sdb2 0 - 0 0 Empty
/dev/sdb3 0 - 0 0 Empty
/dev/sdb4 0 - 0 0 Empty
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: cloud-utils 0.25-0ubuntu5
ProcVersionSign
Uname: Linux 3.2.0-57-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.6
Architecture: amd64
Date: Tue Dec 10 21:28:44 2013
MarkForUpload: True
PackageArchitec
ProcEnviron:
TERM=screen
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: cloud-utils
UpgradeStatus: No upgrade log present (probably fresh install)
| Scott Moser (smoser) wrote : | #1 |
| Scott Moser (smoser) wrote : | #2 |
| Changed in cloud-utils: | |
| status: | New → Fix Committed |
| importance: | Undecided → Medium |
| assignee: | nobody → Scott Moser (smoser) |
| Launchpad Janitor (janitor) wrote : | #3 |
This bug was fixed in the package cloud-utils - 0.27-0ubuntu5
---------------
cloud-utils (0.27-0ubuntu5) trusty; urgency=low
* sync to trunk at revno 250
* cloud-localds: make quiet by default (increase verbosity with '-v')
* ubuntu-
* necessary for the output requested (ie, allow 'armhf' queries of url)
* growpart: fix bug when growing partitions on disks > 2TB. (LP: #1259703)
-- Scott Moser <email address hidden> Wed, 11 Dec 2013 11:39:40 -0500
| Changed in cloud-utils (Ubuntu): | |
| status: | New → Fix Released |
| description: | updated |
| Changed in cloud-utils (Ubuntu Precise): | |
| status: | New → In Progress |
| Changed in cloud-utils (Ubuntu Saucy): | |
| status: | New → In Progress |
| Changed in cloud-utils (Ubuntu Precise): | |
| importance: | Undecided → Medium |
| Changed in cloud-utils (Ubuntu Saucy): | |
| importance: | Undecided → Medium |
| Changed in cloud-utils (Ubuntu): | |
| importance: | Undecided → Medium |
| assignee: | nobody → Scott Moser (smoser) |
| Changed in cloud-utils (Ubuntu Precise): | |
| assignee: | nobody → Scott Moser (smoser) |
| Changed in cloud-utils (Ubuntu Saucy): | |
| assignee: | nobody → Scott Moser (smoser) |
| description: | updated |
| Scott Moser (smoser) wrote : | #4 |
I went ahead and sent a mail about this upstream to util-linux mailing list at http://
I stupidly forgot to put a subject.
Hello Scott, or anyone else affected,
Accepted cloud-utils into saucy-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| Changed in cloud-utils (Ubuntu Saucy): | |
| status: | In Progress → Fix Committed |
| tags: | added: verification-needed |
| Brian Murray (brian-murray) wrote : | #6 |
Hello Scott, or anyone else affected,
Accepted cloud-utils into precise-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| Changed in cloud-utils (Ubuntu Precise): | |
| status: | In Progress → Fix Committed |
| Scott Moser (smoser) wrote : | #7 |
=== Saucy verification ===
$ lsb_release -sc
saucy
$ echo "deb http://
sudo tee /etc/apt/
$ sudo apt-get update -q -y
$ sudo apt-get install -q -y cloud-guest-utils
$ apt-cache policy cloud-guest-utils
cloud-guest-utils:
Installed: 0.27-0ubuntu4.1
Candidate: 0.27-0ubuntu4.1
Version table:
*** 0.27-0ubuntu4.1 0
500 http://
100 /var/lib/
0.27-0ubuntu4 0
500 http://
$ dev="/tmp/my.img"
$ truncate --size 2500G $dev
$ [ -b "$dev" -a "$(lsb_release -sc)" != "precise" ] &&
update_
$ echo update_f=$update_f
update_
$ echo "2048,$
#> removed output
$ sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/tmp/my.img1 2048 1048578047 1048576000 83 Linux
$ growpart ${update_f} $dev 1
CHANGED: partition=1 start=2048 old: size=1048576000 end=1048578048 new: size=4294965248
$ sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/tmp/my.img1 2048 4294967295 4294965248 83 Linux
## now verify that still functions on real disk ~ 20G
$ dev=/dev/vdb
$ [ -b "$dev" -a "$(lsb_release -sc)" != "precise" ] &&
update_
$ echo update_f=$update_f
update_
$ echo "2048,$
#> removed output
$ sudo sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/dev/vdb1 2048 20973567 20971520 83 Linux
$ sudo growpart ${update_f} $dev 1
CHANGED: partition=1 start=2048 old: size=20971520 end=20973568 new: size=41940832,
$ sudo sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/dev/vdb1 2048 41942879 41940832 83 Linux
| Scott Moser (smoser) wrote : | #8 |
=== precise verification ===
$ lsb_release -sc
precise
$ echo "deb http://
sudo tee /etc/apt/
$ sudo apt-get update -q -y && sudo apt-get install -q -y cloud-utils
$ apt-cache policy cloud-utils
cloud-utils:
Installed: 0.25-0ubuntu5.1
Candidate: 0.25-0ubuntu5.1
Version table:
*** 0.25-0ubuntu5.1 0
500 http://
100 /var/lib/
0.25-0ubuntu5 0
500 http://
$ dev="/tmp/my.img"
$ truncate --size 2500G $dev
$ [ "$(lsb_release -sc)" = "precise" ] && update_f="" ||
{ [ -b "$dev" ] && update_
$ echo update_f=$update_f
update_f=
$ echo "2048,$
#> removed output
$ sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/tmp/my.img1 2048 1048578047 1048576000 83 Linux
$ growpart ${update_f} $dev 1
CHANGED: partition=1 start=2048 old: size=1048576000 end=1048578048 new: size=4294965248
$ sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/tmp/my.img1 2048 4294967295 4294965248 83 Linux
## now verify that still functions on real disk ~ 20G
$ dev=/dev/vdb
$ [ "$(lsb_release -sc)" = "precise" ] && update_f="" ||
{ [ -b "$dev" ] && update_
$ echo update_f=$update_f
update_f=
$ echo "2048,$
#> removed output
$ sudo sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/dev/vdb1 2048 20973567 20971520 83 Linux
$ sudo growpart ${update_f} $dev 1
CHANGED: partition=1 start=2048 old: size=20971520 end=20973568 new: size=41940832,
$ sudo sfdisk --unit S -l $dev 2>/dev/null | grep "${dev}1"
/dev/vdb1 2048 41942879 41940832 83 Linux
| tags: |
added: verification-done removed: verification-needed |
| Launchpad Janitor (janitor) wrote : | #9 |
This bug was fixed in the package cloud-utils - 0.25-0ubuntu5.1
---------------
cloud-utils (0.25-0ubuntu5.1) precise-proposed; urgency=low
* fix growpart when disks operated on are larger than 2TB (LP: #1259703)
-- Scott Moser <email address hidden> Wed, 11 Dec 2013 15:53:20 -0500
| Changed in cloud-utils (Ubuntu Precise): | |
| status: | Fix Committed → Fix Released |
The verification of the Stable Release Update for cloud-utils has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.
| Launchpad Janitor (janitor) wrote : | #11 |
This bug was fixed in the package cloud-utils - 0.27-0ubuntu4.1
---------------
cloud-utils (0.27-0ubuntu4.1) saucy-proposed; urgency=low
* fix growpart when disks operated on are larger than 2TB (LP: #1259703)
-- Scott Moser <email address hidden> Wed, 11 Dec 2013 15:18:42 -0500
| Changed in cloud-utils (Ubuntu Saucy): | |
| status: | Fix Committed → Fix Released |
| Scott Moser (smoser) wrote : | #12 |
fixed in 0.28
| Changed in cloud-utils: | |
| status: | Fix Committed → Fix Released |


fixed in trunk at revision 250.