From 2f081e91c893d3e57fbdcc65be0989d533304c45 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Mon, 3 Nov 2014 13:07:29 -0800 Subject: [PATCH 1/2] disk_util: ensure partitions are layed out on disk in order So far the default iteration order of python dicts has mostly matched the order that we want the partitions on disk but this is not always the case. I caught the BIOS-BOOT partition being ordered on disk after the USR-A partition. Nothing bad came of this but consistancy is good. --- build_library/disk_util | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_library/disk_util b/build_library/disk_util index 61c177778e..dd0054564d 100755 --- a/build_library/disk_util +++ b/build_library/disk_util @@ -127,7 +127,7 @@ def LoadPartitionConfig(options): for base_key, base_value in base_part.iteritems(): part.setdefault(base_key, base_value) - for part_num, part in layout.iteritems(): + for part_num, part in sorted(layout.iteritems(), key=lambda t: int(t[0])): if part['type'] == 'blank': continue From 7ba6381f381a0aeb09529b9f6fc6289b84f11f47 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Mon, 3 Nov 2014 13:19:58 -0800 Subject: [PATCH 2/2] disk_layout: align partitions and disk sizes to 2MB The VHD format actually uses 2MB blocks internally so the 1MB alignment used in e77e4e54 wasn't sufficent to prevent other tools from further adjusting the image size to align it. Additionally a 1MB alignment may be triggering a bug in OpenStack or XenServer disk resizing that renders that partial block at the end of the old image size unmapped/unavailabe. --- build_library/disk_layout.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build_library/disk_layout.json b/build_library/disk_layout.json index ec59424785..6071867f37 100644 --- a/build_library/disk_layout.json +++ b/build_library/disk_layout.json @@ -1,9 +1,9 @@ { "_comment": "See http://www.chromium.org/chromium-os/building-chromium-os/disk-layout-format", "metadata":{ - "_comment": "Partitions are aligned to 1MB (2048 blocks), disks sizes should align to *both* 1MB and a CHS cylender boundry for the common 16H 63S geometry (16*63 = 1008 blocks). The least common multiple of 2048 and 1008 is 129024 blocks.", - "part_alignment": 2048, - "disk_alignment": 129024, + "_comment": "Partitions are aligned to 2MB (4096 blocks). For the sake of VHD disks sizes should align to *both* 2MB and a CHS cylender boundry for the common 16H 63S geometry (16*63 = 1008 blocks). The least common multiple of 4096 and 1008 is 258048 blocks.", + "part_alignment": 4096, + "disk_alignment": 258048, "block_size": 512, "fs_block_size": 4096 }, @@ -64,7 +64,7 @@ "9":{ "label":"ROOT", "type":"coreos-resize", - "blocks":"4302848", + "blocks":"4427776", "fs_type":"btrfs", "fs_subvolume":"root", "mount":"/" @@ -73,19 +73,19 @@ "vm":{ "9":{ "label":"ROOT", - "blocks":"12689408" + "blocks":"12943360" } }, "azure":{ "9":{ "label":"ROOT", - "blocks":"58752990" + "blocks":"58875904" } }, "vagrant":{ "9":{ "label":"ROOT", - "blocks":"33591296" + "blocks":"33845248" } }, "onmetal":{