kiwi.filesystem Package

Submodules

kiwi.filesystem.base Module

class kiwi.filesystem.base.FileSystemBase(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: object

Implements base class for filesystem interface

Parameters:
  • device_provider (object) – Instance of a class based on DeviceProvider required for filesystems which needs a block device for creation. In most cases the DeviceProvider is a LoopDevice

  • root_dir (string) – root directory path name

  • custom_args (dict) – custom filesystem arguments

create_on_device(label: str | None = None, size: int = 0, unit: str = 'k', uuid: str | None = None)[source]

Create filesystem on block device

Implement in specialized filesystem class for filesystems which requires a block device for creation, e.g ext4.

Parameters:
  • label (str) – label name

  • size (int) – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit (str) – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid (str) – UUID name

create_on_file(filename: str, label: str | None = None, exclude: List[str] | None = None)[source]

Create filesystem from root data tree

Implement in specialized filesystem class for filesystems which requires a data tree for creation, e.g squashfs.

Parameters:
  • filename (string) – result file path name

  • label (string) – label name

  • exclude (list) – list of exclude dirs/files

create_verification_metadata(device_node: str = '') None[source]

Write verification block at the end of the device

Parameters:

device_node (str) – Target device node, if not specified the root device from this instance is used

create_verity_layer(blocks: int | None = None, filename: str | None = None)[source]

Create veritysetup on device

Parameters:
  • block (int) – Number of blocks to use for veritysetup. If not specified the entire root device is used

  • filename (str) – Target filename to use for VeritySetup. If not specified the filename or block special provided at object construction time is used

get_fstab(persistency_type: str = 'by-label', filesystem_name: str = '') List[str][source]

Consistency layer with regards to VolumeManager classes

Raises

get_mountpoint() str | None[source]

Provides mount point directory

Effective use of the directory is guaranteed only after sync_data

Returns:

directory path name

Return type:

string

get_root_volume_name() None[source]

Consistency layer with regards to VolumeManager classes

Raises

get_volumes() Dict[source]

Consistency layer with regards to VolumeManager classes

Raises

mount() None[source]

Mount the filesystem

mount_volumes() None[source]

Consistency layer with regards to VolumeManager classes

Invokes mount

post_init(custom_args: Dict)[source]

Post initialization method

Store dictionary of custom arguments if not empty. This overrides the default custom argument hash

Parameters:

custom_args (dict) –

custom arguments

{
    'create_options': ['option'],
    'mount_options': ['option'],
    'meta_data': {
        'key': 'value'
    }
}

set_property_readonly_root() None[source]

Consistency layer with regards to VolumeManager classes

Raises

set_uuid()[source]

Create new random filesystem UUID

Implement in specialized filesystem class for filesystems which supports the concept of an UUID and allows to change it

sync_data(exclude: List[str] = []) MountManager[source]

Copy data tree into filesystem

Parameters:

exclude (list) – list of exclude dirs/files

Returns:

The mount created for syncing data. It should be used to un-mount the filesystem again.

umount() None[source]

Umounts the filesystem in case it is mounted, does nothing otherwise

umount_volumes() None[source]

Consistency layer with regards to VolumeManager classes

Invokes umount

kiwi.filesystem.btrfs Module

class kiwi.filesystem.btrfs.FileSystemBtrfs(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: FileSystemBase

Implements creation of btrfs filesystem

create_on_device(label: str | None = None, size: int = 0, unit: str = 'k', uuid: str | None = None)[source]

Create btrfs filesystem on block device

Parameters:
  • label (str) – label name

  • size (int) – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit (str) – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid (str) – UUID name

set_uuid()[source]

Create new random filesystem UUID

kiwi.filesystem.ext2 Module

class kiwi.filesystem.ext2.FileSystemExt2(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: FileSystemBase

Implements creation of ext2 filesystem

create_on_device(label: str | None = None, size: int = 0, unit: str = 'k', uuid: str | None = None)[source]

Create ext2 filesystem on block device

Parameters:
  • label (str) – label name

  • size (int) – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit (str) – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid (str) – UUID name

set_uuid()[source]

Create new random filesystem UUID

kiwi.filesystem.ext3 Module

class kiwi.filesystem.ext3.FileSystemExt3(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: FileSystemBase

Implements creation of ext3 filesystem

create_on_device(label: str | None = None, size: int = 0, unit: str = 'k', uuid: str | None = None)[source]

Create ext3 filesystem on block device

Parameters:
  • label (str) – label name

  • size (int) – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit (str) – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid (str) – UUID name

set_uuid()[source]

Create new random filesystem UUID

kiwi.filesystem.ext4 Module

class kiwi.filesystem.ext4.FileSystemExt4(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: FileSystemBase

Implements creation of ext4 filesystem

create_on_device(label: str | None = None, size: int = 0, unit: str = 'k', uuid: str | None = None)[source]

Create ext4 filesystem on block device

Parameters:
  • label (str) – label name

  • size (int) – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit (str) – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid (str) – UUID name

set_uuid()[source]

Create new random filesystem UUID

kiwi.filesystem.fat16 Module

class kiwi.filesystem.fat16.FileSystemFat16(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: FileSystemBase

Implements creation of fat16 filesystem

create_on_device(label: str | None = None, size: int = 0, unit: str = 'k', uuid: str | None = None)[source]

Create fat16 filesystem on block device

Parameters:
  • label (str) – label name

  • size (int) – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit (str) – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid (str) – Volume Label, there is no real UUID on fat

set_uuid()[source]

Create new random filesystem UUID

kiwi.filesystem.fat32 Module

class kiwi.filesystem.fat32.FileSystemFat32(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: FileSystemBase

Implements creation of fat32 filesystem

create_on_device(label: str | None = None, size: int = 0, unit: str = 'k', uuid: str | None = None)[source]

Create fat32 filesystem on block device

Parameters:
  • label (str) – label name

  • size (int) – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit (str) – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid (str) – Volume Label, there is no real UUID on fat

set_uuid()[source]

Create new random filesystem UUID

kiwi.filesystem.isofs Module

class kiwi.filesystem.isofs.FileSystemIsoFs(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: FileSystemBase

Implements creation of iso filesystem

create_on_file(filename: str, label: str | None = None, exclude: List[str] | None = None)[source]

Create iso filesystem from data tree

There is no label which could be set for iso filesystem thus this parameter is not used

Parameters:
  • filename (string) – result file path name

  • label (string) – unused

  • exclude (list) – unused

kiwi.filesystem.setup Module

class kiwi.filesystem.setup.FileSystemSetup(xml_state: XMLState, root_dir: str)[source]

Bases: object

Implement filesystem setup methods

Methods from this class provides information from the root directory required before building a filesystem image

Parameters:
  • xml_state (object) – Instance of XMLState

  • root_dir (string) – root directory path

get_size_mbytes(filesystem: str | None = None) int[source]

Precalculate the requires size in mbytes to store all data from the root directory in the requested filesystem. Return the configured value if present, if not return the calculated result

Parameters:

filesystem (string) – name

Returns:

mbytes

Return type:

int

kiwi.filesystem.squashfs Module

class kiwi.filesystem.squashfs.FileSystemSquashFs(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: FileSystemBase

Implements creation of squashfs filesystem

create_on_file(filename, label: str | None = None, exclude: List[str] | None = None)[source]

Create squashfs filesystem from data tree

There is no label which could be set for squashfs thus this parameter is not used

Parameters:
  • filename (string) – result file path name

  • label (string) – unused

  • exclude (list) – list of exclude dirs/files

kiwi.filesystem.xfs Module

class kiwi.filesystem.xfs.FileSystemXfs(device_provider: DeviceProvider, root_dir: str = '', custom_args: Dict = {})[source]

Bases: FileSystemBase

Implements creation of xfs filesystem

create_on_device(label: str | None = None, size: int = 0, unit: str = 'k', uuid: str | None = None)[source]

Create xfs filesystem on block device

Parameters:
  • label (str) – label name

  • size (int) – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit (str) – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid (str) – UUID name

set_uuid()[source]

Create new random filesystem UUID

Module Contents

class kiwi.filesystem.FileSystem[source]

Bases: object

FileSystem factory

Parameters:
  • name (string) – filesystem name

  • device_provider (object) – Instance of DeviceProvider

  • root_dir (string) – root directory path name

  • custom_args (dict) – dict of custom filesystem arguments

static new(name: str, device_provider: DeviceProvider, root_dir: str | None = None, custom_args: Dict | None = None)[source]