Currently, only basic mounting/unmounting works. Persistency and mount flags (i.e. bind) are not implemented, yet. These limitations will be addressed in the future releases.

Every mount is represented by an LMI_MountedFileSystem instance. Each instance can have one or two LMI_MountedFileSystemSetting instances associated to it via LMI_MountedFileSystemElementSettingData (one for the currently mounted filesystem and one for a persistent entry in /etc/fstab). This association class has two important properties – IsCurrent and IsNext . Their meaning is described in detail in the On modes section.

LMI_MountedFileSystemSetting is used for representing mount options (e.g. whether to mount read-write or read-only).

The setting instance can also exists on its own. This means that it’s not connected with LMI_MountedFileSystem by any association. Such situation can happen after CreateSetting is called. According to its ChangeableType property, it is either deleted after an hour (ChangeableType = Transient), or has to be associated or deleted manually (Changeable = Persistent).

Local filesystems are represented by LMI_LocalFileSystem class and its subclasses. Filesystems are associated to LMI_MountedFileSystem via LMI_AttachedFileSystem .


Currently, only local filesystems are supported.

When a filesystem is currently mounted, the directory where the LMI_MountedFileSystem instance is attached at is represented by an LMI_UnixDirectory instance. These two instances are connected through an LMI_MountPoint association instance.

The following diagram shows a local ext4 partition /dev/sda2 currently mounted at /boot. The filesystem is specified by its UUID. No persitent entry in /etc/fstab is managed.

The next figure shows a local ext3 partition /dev/sda1 mounted at /home and also made persistent in /etc/fstab, both with slightly different mount options. The filesystem is specified by its UUID. Notice that the mount options are represented by two different LMI_MountedFileSystemSetting instances.

The final diagram represents a state where a local ext4 partition /dev/sda4, filesystem of which is specified by its UUID, is mounted at /var/log and also has the respective entry written in /etc/fstab. Note that both settings (current mount and the persistent entry) are the same, as is indicated by IsNext and IsCurrent being set to 1.


TODO: bind mount examples, remote fs examples

Using the mounting API

On modes

When calling CreateMount or DeleteMount methods, one of their arguments is a mode. The mode is an enumeration that denotes values of two different properties of the LMI_MountedFileSystemElementSettingData association. They are IsNext and IsCurrent. They determine if the mount operation performs mount only, adds a persistent entry to /etc/fstab, or both.

The following table displays possible values and their respective meanings of IsNext and IsCurrent .

  Value Meaning
IsNext 1 This property indicates if the associated setting will be applied as mount options on next reinitialization, i.e. on reboot. In mounting this means persistency, an entry in /etc/fstab.
2 No entry in /etc/fstab.
IsCurrent 1 This property indicates if the associated setting represents current mount options of the MountedFileSystem.
2 The device is not mounted.

Supported modes of CreateMount, ModifyMount and DeleteMount methods and their meaning are described in the following table. See decription of the methods for details.

Mode IsNext IsCurrent
1 1 1
2 1 Not affected.
4 2 2
5 2 Not affected.
32768 Not affected. 1
32769 Not affected. 2


Mounts a device to the specified mountpoint.
Modifies (remounts) the specified filesystem.
Unmounts the specified filesystem.

All the methods are asynchronous.

DeleteMount() note

If, after DeleteMount, IsNext and IsCurrent are both set to 2 (device was unmounted and its persistent entry removed), the corresponding LMI_MountedFileSystem, LMI_MountedFileSystemSetting and their association are removed. This implies that there cannot be any LMI_MountedFileSystemElementSettingData with both IsNext and IsCurrent set to 2.

Use cases


All example scripts expect properly initialized lmishell.

Typical use of the mounting API could be like the following:

Use an LMI_MountedFileSystemCapabilities instance to create a setting instance using the CreateSetting method. This method creates an instance of LMI_MountedFileSystemSetting class with default property values.

Modify the setting instance as needed. This is done using the ModifyInstance intrinsic method. This step is optional if the admin is satisfied with the default set of values.

Use an LMI_MountConfigurationService to create a mount using the CreateMount method or modify a mount using the ModifyMount method. You can also use an LMI_MountConfigurationService to unmount a mount using the DeleteMount .

Example 1

This example demonstrates mounting /dev/sda partition with a customized setting.

cap = ns.LMI_MountedFileSystemCapabilities.first_instance()

# Create an LMI_MountedFileSystemSetting instance
(rc, out, err) = cap.CreateSetting()
setting_name = out['Setting']
setting = setting_name.to_instance()

# Modify the setting instance with requested options
setting.AllowWrite = False
setting.InterpretDevices = False

# Find the filesystem to mount
sda1 = ns.CIM_StorageExtent.first_instance({"Name": "/dev/sda1"})
fs = sda1.first_associator(ResultClass='LMI_LocalFileSystem')

# Mount it
# Mode == 32768 -> only mount, no fstab entry
mount_service = ns.LMI_MountConfigurationService.first_instance()
(rc, out, err) = mount_service.SyncCreateMount(

Example 2

In this example, /mnt, that was mounted in Example 1, is unmounted.

mount_service = ns.LMI_MountConfigurationService.first_instance()

mnt = ns.LMI_MountedFileSystem.first_instance({"MountPointPath": "/mnt/test"})

if not mnt:
    raise BaseException("Mountpoint does not exist: /mnt/test")

(rc, out, err) = mount_service.SyncDeleteMount(


Currently, only basic mounting/unmounting works. Persistency and mount flags (i.e. bind) are not implemented, yet. These limitations will be addressed in the future releases.