Skip to content

Commit a690a2a

Browse files
ader1990pothos
authored andcommitted
Increase partition sizes
The /usr partition was too small some time ago and we gained space again by switching to btrfs with compression and also removing/splitting out content. The /boot partition is too small all the time and we added many hacks to fit the kernel+initrd under 60 MB. To handle the case where the /oem partition is too small for the A/B-updated OEM extensions we added the workaround to write the inactive one (or both) to the rootfs. All this would not be needed if we had increased the partition sizes a few years ago so that we could now assume that most nodes have the increased sizes and we can make use of them. Still, we can do it now to prepare for the next time when in five or ten years we have serious size problems and run out of workarounds. We have to do the change now and wait a few years so that most nodes have been provisioned with the new layout. Then we can drop the workarounds and have a full featured kernel and initrd, and we can also increase the /usr filesystem to make use of the larger partition. Ideally we use large enough sizes that we never have to worry again but since we also want to support small ARM boards which might only have 8 GB internal storage, let's target this when increasing the partition sizes. With 1 GB /boot, two 2 GB /usr, and 1 GB /oem partitions we are already at 6 GB, leaving 2 GB for the rootfs. For now, reduce the extracted /usr update payload size to the current combined filesystem and verity data usage (same size as before). The rootfs size was also reduced for the initial .bin image so that we don't overshoot 8 GB - it will be resized to fit the disk anyway on first boot. Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com> Signed-off-by: Kai Lueke <kailuke@microsoft.com>
1 parent 198eb73 commit a690a2a

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
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: 5 additions & 2 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,8 @@ 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+
if part.get('extract_blocks', None):
140+
part['extract_bytes'] = part['extract_blocks'] * metadata['block_size']
139141

140142
if part['fs_bytes'] > part['bytes']:
141143
raise InvalidLayout(
@@ -823,6 +825,7 @@ def Extract(options):
823825
if not part['image_compat']:
824826
raise InvalidLayout("Disk layout is incompatible with existing image")
825827

828+
extract_size = part.get('extract_bytes', part['image_bytes'])
826829
subprocess.check_call(['dd',
827830
'bs=10MB',
828831
'iflag=count_bytes,skip_bytes',

0 commit comments

Comments
 (0)