Skip to content

Commit 1fa8f44

Browse files
authored
Merge pull request #3027 from flatcar/ader1990/increase_boot_partition
Increase partition sizes
2 parents 5b3fd36 + f0c94a9 commit 1fa8f44

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

build_library/disk_layout.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"label":"EFI-SYSTEM",
1414
"fs_label":"EFI-SYSTEM",
1515
"type":"efi",
16-
"blocks":"262144",
16+
"blocks":"2097152",
1717
"fs_type":"vfat",
1818
"mount":"/boot",
1919
"features": []
@@ -27,7 +27,8 @@
2727
"label":"USR-A",
2828
"uuid":"7130c94a-213a-4e5a-8e26-6cce9662f132",
2929
"type":"flatcar-rootfs",
30-
"blocks":"2097152",
30+
"blocks":"4194304",
31+
"extract_blocks":"2097152",
3132
"fs_blocks":"260094",
3233
"fs_type":"btrfs",
3334
"fs_compression":"zstd",
@@ -38,7 +39,8 @@
3839
"label":"USR-B",
3940
"uuid":"e03dd35c-7c2d-4a47-b3fe-27f15780a57c",
4041
"type":"flatcar-rootfs",
41-
"blocks":"2097152",
42+
"blocks":"4194304",
43+
"extract_blocks":"2097152",
4244
"fs_blocks":"262144"
4345
},
4446
"5":{
@@ -51,7 +53,7 @@
5153
"label":"OEM",
5254
"fs_label":"OEM",
5355
"type":"data",
54-
"blocks":"262144",
56+
"blocks":"2097152",
5557
"fs_type":"btrfs",
5658
"fs_compression":"zlib",
5759
"mount":"/oem"
@@ -70,7 +72,7 @@
7072
"label":"ROOT",
7173
"fs_label":"ROOT",
7274
"type":"flatcar-resize",
73-
"blocks":"4427776",
75+
"blocks":"3653632",
7476
"fs_type":"ext4",
7577
"mount":"/"
7678
}

build_library/disk_util

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ def LoadPartitionConfig(options):
4040
'_comment', 'type', 'num', 'label', 'blocks', 'block_size', 'fs_blocks',
4141
'fs_block_size', 'fs_type', 'features', 'uuid', 'part_alignment', 'mount',
4242
'binds', 'fs_subvolume', 'fs_bytes_per_inode', 'fs_inode_size', 'fs_label',
43-
'fs_compression'))
43+
'fs_compression', 'extract_blocks'))
4444
integer_layout_keys = set((
4545
'blocks', 'block_size', 'fs_blocks', 'fs_block_size', 'part_alignment',
46-
'fs_bytes_per_inode', 'fs_inode_size'))
46+
'fs_bytes_per_inode', 'fs_inode_size', 'extract_blocks'))
4747
required_layout_keys = set(('type', 'num', 'label', 'blocks'))
4848

4949
filename = options.disk_layout_file
@@ -136,6 +136,13 @@ def LoadPartitionConfig(options):
136136
part.setdefault('fs_block_size', metadata['fs_block_size'])
137137
part.setdefault('fs_blocks', part['bytes'] // part['fs_block_size'])
138138
part['fs_bytes'] = part['fs_blocks'] * part['fs_block_size']
139+
# The partition may specify extract_blocks to limit what content gets
140+
# extracted. The use case is the /usr partition where we can grow the
141+
# partition but can't directly grow the filesystem and the update
142+
# payload until all (or most) nodes are running the partition layout
143+
# with the grown /usr partition (which can take a few years).
144+
if part.get('extract_blocks', None):
145+
part['extract_bytes'] = part['extract_blocks'] * metadata['block_size']
139146

140147
if part['fs_bytes'] > part['bytes']:
141148
raise InvalidLayout(
@@ -823,6 +830,7 @@ def Extract(options):
823830
if not part['image_compat']:
824831
raise InvalidLayout("Disk layout is incompatible with existing image")
825832

833+
extract_size = part.get('extract_bytes', part['image_bytes'])
826834
subprocess.check_call(['dd',
827835
'bs=10MB',
828836
'iflag=count_bytes,skip_bytes',
@@ -831,7 +839,7 @@ def Extract(options):
831839
'if=%s' % options.disk_image,
832840
'of=%s' % options.output,
833841
'skip=%s' % part['image_first_byte'],
834-
'count=%s' % part['image_bytes']])
842+
'count=%s' % extract_size])
835843

836844

837845
def GetPartitionByNumber(partitions, num):

build_library/vm_image_util.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,11 @@ IMG_ami_vmdk_DISK_FORMAT=vmdk_stream
224224
IMG_ami_vmdk_OEM_USE=ami
225225
IMG_ami_vmdk_OEM_PACKAGE=common-oem-files
226226
IMG_ami_vmdk_SYSEXT=oem-ami
227+
IMG_ami_vmdk_DISK_LAYOUT=vm
227228
IMG_ami_OEM_USE=ami
228229
IMG_ami_OEM_PACKAGE=common-oem-files
229230
IMG_ami_OEM_SYSEXT=oem-ami
231+
IMG_ami_DISK_LAYOUT=vm
230232

231233
## openstack
232234
IMG_openstack_DISK_FORMAT=qcow2
@@ -342,6 +344,7 @@ IMG_kubevirt_OEM_SYSEXT=oem-kubevirt
342344
IMG_kubevirt_DISK_EXTENSION=qcow2
343345

344346
## akamai (Linode)
347+
IMG_akamai_DISK_LAYOUT=vm
345348
IMG_akamai_OEM_PACKAGE=common-oem-files
346349
IMG_akamai_OEM_USE=akamai
347350
IMG_akamai_OEM_SYSEXT=oem-akamai
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Increased all partition sizes: `/boot` to 1 GB, the two `/usr` partitions to 2 GB, `/oem` to 1 GB so that we can use more space in a few years when we can assume that most nodes run the new partition layout - existing nodes can still update for the next years ([scripts#3027](https://github.com/flatcar/scripts/pull/3027))

0 commit comments

Comments
 (0)