mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 14:11:07 +02:00
disk_util: allocate the maximum number of usable inodes
This change changes the default 'bytes-per-inode' ration from 16K to 4K, the block size. To prevent this from wasting too much space change the inode size from the default 256 to the minimum size, 128. Larger inodes are used to store extended attributes more efficiently but since we do not use SELinux the majority of files do not have security attributes. These defaults may be modified via the new `bytes_per_inode` and `inode_size` options.
This commit is contained in:
parent
f5ec568cee
commit
d09aeb368c
@ -45,9 +45,10 @@ def LoadPartitionConfig(options):
|
|||||||
valid_layout_keys = set((
|
valid_layout_keys = set((
|
||||||
'_comment', 'type', 'num', 'label', 'blocks', 'block_size', 'fs_blocks',
|
'_comment', 'type', 'num', 'label', 'blocks', 'block_size', 'fs_blocks',
|
||||||
'fs_block_size', 'fs_type', 'features', 'uuid', 'part_alignment', 'mount',
|
'fs_block_size', 'fs_type', 'features', 'uuid', 'part_alignment', 'mount',
|
||||||
'binds', 'fs_subvolume'))
|
'binds', 'fs_subvolume', 'fs_bytes_per_inode', 'fs_inode_size'))
|
||||||
integer_layout_keys = set((
|
integer_layout_keys = set((
|
||||||
'blocks', 'block_size', 'fs_blocks', 'fs_block_size', 'part_alignment'))
|
'blocks', 'block_size', 'fs_blocks', 'fs_block_size', 'part_alignment',
|
||||||
|
'fs_bytes_per_inode', 'fs_inode_size'))
|
||||||
required_layout_keys = set(('type', 'num', 'label', 'blocks'))
|
required_layout_keys = set(('type', 'num', 'label', 'blocks'))
|
||||||
|
|
||||||
filename = options.disk_layout_file
|
filename = options.disk_layout_file
|
||||||
@ -108,6 +109,10 @@ def LoadPartitionConfig(options):
|
|||||||
if part.get('fs_type', None) != 'btrfs':
|
if part.get('fs_type', None) != 'btrfs':
|
||||||
raise InvalidLayout('Invalid fs: only btrfs supports subvolumes')
|
raise InvalidLayout('Invalid fs: only btrfs supports subvolumes')
|
||||||
|
|
||||||
|
if 'fs_bytes_per_inode' in part or 'fs_inode_size' in part:
|
||||||
|
if part.get('fs_type', None) not in ('ext2', 'ext4'):
|
||||||
|
raise InvalidLayout('Invalid fs: only extX supports inode options')
|
||||||
|
|
||||||
def Align(count, alignment):
|
def Align(count, alignment):
|
||||||
offset = count % alignment
|
offset = count % alignment
|
||||||
if offset:
|
if offset:
|
||||||
@ -393,6 +398,8 @@ def FormatExt(part, device):
|
|||||||
Sudo(['mke2fs', '-q',
|
Sudo(['mke2fs', '-q',
|
||||||
'-t', part['fs_type'],
|
'-t', part['fs_type'],
|
||||||
'-b', part['fs_block_size'],
|
'-b', part['fs_block_size'],
|
||||||
|
'-i', part.get('fs_bytes_per_inode', part['fs_block_size']),
|
||||||
|
'-I', part.get('fs_inode_size', 128),
|
||||||
device,
|
device,
|
||||||
part['fs_blocks']])
|
part['fs_blocks']])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user