[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Major large-disk bug for cloud-utils / cloud-initramfs-growroot



Hi Juerg,

Thanks for chiming in.

On Wed, Oct 22, 2014 at 12:34 AM, Juerg Haefliger <juergh@gmail.com> wrote:
On Wed, Oct 22, 2014 at 8:53 AM, Thomas Goirand <zigo@debian.org> wrote:
> On 10/22/2014 01:49 PM, Jimmy Kaplowitz wrote:

> In the current version of cloud-utils, there's no such thing as
> "max_end", and the way to patch really isn't trivial (please read the
> source code and try to make sense out of it, then you tell me what you
> think...).

Hmm... There is max_end in the current version. How about this:

--- cloud-utils-0.26/bin/growpart.orig    2014-10-22 09:23:07.455279618 +0200
+++ cloud-utils-0.26/bin/growpart    2014-10-22 09:26:46.627273142 +0200
@@ -119,6 +119,7 @@ tmp="${TEMP_D}/tmp.out"
 err="${TEMP_D}/err.out"
 orig_bin="${TEMP_D}/orig.save"
 RESTORE_HUMAN="${TEMP_D}/recovery"
+mbr_max_512="4294967296"
 
 # --show-pt-geometry outputs something like
 #     /dev/sda: 164352 cylinders, 4 heads, 32 sectors/track
@@ -130,6 +131,8 @@ sfdisk "${disk}" --show-pt-geometry > "$
 tot=$((${cyl}*${heads}*${sectors}))
 
 debug 1 "geometry is $CHS. total size=${tot}"
+[ "$tot" -gt "$mbr_max_512" ] &&
+    debug 1 "WARN: disk is larger than 2TB. additional space will go unused."
 sfdisk ${CHS} -uS -d "${disk}" > "${dump_out}" 2>"${err}" ||
     fail "failed to dump sfdisk info for ${disk}"
 
@@ -166,6 +169,10 @@ max_end=$(awk '
     [ -n "${max_end}" ] ||
     fail "failed to get max_end for partition ${part}"
 
+if [ "$max_end" -gt "$mbr_max_512" ]; then
+    max_end=$mbr_max_512
+fi
+
 debug 1 "max_end=${max_end} tot=${tot} pt_end=${pt_end} pt_start=${pt_start} pt_size=${pt_size}"
 [ $((${pt_end})) -eq ${max_end} ] &&
     nochange "partition ${part} is size ${pt_size}. it cannot be grown"

This patch seems sane and simple enough. Instead of trying a whole new upstream version which would be a tougher unblock request, I'll build a package with this change and see how it works in GCE. I'd appreciate it if someone else can try it out in their preferred cloud of choice. My test might not occur tomorrow, but as mentioned, I'll try to do it within the next week so that this can be fully integrated long before the December 5 deadline for important severity bugs.

- Jimmy

Reply to: