mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 05:51:43 +01:00
Merge pull request #379 from marineam/inodes
disk_util: allocate the maximum number of usable inodes
This commit is contained in:
commit
5fdcb81ae9
@ -45,9 +45,10 @@ def LoadPartitionConfig(options):
|
||||
valid_layout_keys = set((
|
||||
'_comment', 'type', 'num', 'label', 'blocks', 'block_size', 'fs_blocks',
|
||||
'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((
|
||||
'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'))
|
||||
|
||||
filename = options.disk_layout_file
|
||||
@ -108,6 +109,10 @@ def LoadPartitionConfig(options):
|
||||
if part.get('fs_type', None) != 'btrfs':
|
||||
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):
|
||||
offset = count % alignment
|
||||
if offset:
|
||||
@ -393,6 +398,8 @@ def FormatExt(part, device):
|
||||
Sudo(['mke2fs', '-q',
|
||||
'-t', part['fs_type'],
|
||||
'-b', part['fs_block_size'],
|
||||
'-i', part.get('fs_bytes_per_inode', part['fs_block_size']),
|
||||
'-I', part.get('fs_inode_size', 128),
|
||||
device,
|
||||
part['fs_blocks']])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user