Filesystems and data formats

Filesystem management functions.

lmi.scripts.storage.fs.create_fs(ns, devices, fs, label=None)[source]

Format given devices with a filesystem. If multiple devices are provided, the format will span over all these devices (currently supported only for btrfs).

Parameters:
  • devices (list of LMIInstance/CIM_StorageExtent or list of strings) – Devices to format.
  • fs (string) – Requested filesystem type (case-insensitive).
  • label (string) – The filesystem label.
Return type:

LMIInstance/CIM_LocalFileSystem

lmi.scripts.storage.fs.delete_format(ns, fmt)[source]

Remove given filesystem or data format from all devices, where it resides.

Parameters:fmt (LMIInstance/CIM_LocalFileSystem or LMIInstance/LMI_DataFormat) – Format to delete.
lmi.scripts.storage.fs.get_device_format_label(ns, device)[source]

Return short text description of the format, ready for printing.

Parameters:device (LMIInstance/CIM_StorageExtent or string) – Device to describe.
Return type:string
lmi.scripts.storage.fs.get_format_label(_ns, fmt)[source]

Return short text description of the format, ready for printing.

Parameters:fmt (LMIInstance/CIM_LocalFileSystem or LMIInstance/LMI_DataFormat) – Format to describe.
Return type:string
lmi.scripts.storage.fs.get_format_on_device(ns, device, format_type=3)[source]

Return filesystem or data format, which is on given device.

Parameters:
  • device (LMIInstance/CIM_StorageExtent or string) – Device to to examine.
  • format_type (int) –

    Type of format to find.

    • FORMAT_ALL - return either CIM_LocalFileSystem or LMI_DataFormat.
    • FORMAT_FS - return only CIM_LocalFileSystem or None, if there is no
      filesystem on the device.
    • FORMAT_DATA - return only LMI_DataFormat or None, if there is no
      data format on the device.
Return type:

LMIInstance/CIM_LocalFileSystem or LMIInstance/LMI_DataFormat

lmi.scripts.storage.fs.get_formats(ns, devices=None, format_type=3, nodevfs=False)[source]

Retrieve list of filesystems on given devices. If no devices are given, all formats on all devices are returned.

Parameters:
  • devices (list of LMIInstance/CIM_StorageExtent or list of strings) – Devices to list formats on.
  • format_type (int) –

    Type of formats to find.

    • FORMAT_ALL - return either CIM_LocalFileSystem or LMI_DataFormat.
    • FORMAT_FS - return only CIM_LocalFileSystem or None, if there is no
      filesystem on the device.
    • FORMAT_DATA - return only LMI_DataFormat or None, if there is no
      data format on the device.
  • nodevfs (bool) – Whether non-device filesystems like tmpfs, cgroup, procfs etc. should be returned.
Return type:

list of LMIInstance/CIM_LocalFileSystem or LMIInstance/LMI_DataFormat

lmi.scripts.storage.fs.str2format(ns, fmt)[source]

Convert string with name of device to LMIInstance of the format on the device.

If LMIInstance is provided, nothing is done and the instance is just returned. If a string is given, appropriate LMIInstance is looked up and returned.

This functions throws an error when the device cannot be found.

Parameters:fmt (LMIInstance/CIM_LocalFileSystem or LMIInstance/LMI_DataFormat or string) – The format.
Retval :LMIInstance/CIM_LocalFileSystem or LMIInstance/LMI_DataFormat

Previous topic

MD RAID

Next topic

Printing

This Page