These commands allow listing and manipulation with block devices.
<device> can be specified as one of:
- DeviceID of appropriate CIM_StorageExtent. This is internal OpenLMI ID of the device and it should be stable across system reboots.
- Device name directly in /dev directory, such as /dev/sda. This device name is available as Name property of CIM_StorageExtent.
- Name of MD RAID or logical volume. This method cannot be used when the name is not unique, for example when there are two logical volumes with the same name, allocated from different volume groups. This name is available as ElementName property of CIM_StorageExtent.
<vg> represents name of a volume group, with or without /dev/ prefix.
Any <size>, such as size of new partition or new logical volume, can be specified with ‘T’, ‘G’, ‘M’ or ‘K’ suffix, which represents appropriate unit (terabytes, gigabytes etc.) 1K (kilobyte) is 1024 of bytes. The suffix is case insensitive, i.e. 1g = 1G.
Filesystem and other data format management.
Usage:
lmi fs list [–all] [ <device> ...]
lmi fs create [ –label=<label> ] <fstype> <device> ...
lmi fs delete <device> ...
lmi fs list-supported
Commands:
- list
- List filesystems and and other data formats (RAID metadata, ...) on given devices. If no devices are provided, all filesystems are listed. If –all option is set, all filesystem, including system ones like tmpfs, cgroups, procfs, sysfs etc are listed.
- create
Format device(s) with given filesystem. If more devices are given, the filesystem will span over these devices (currently supported only by btrfs).
For list of available filesystem types, see output of lmi fs list-supported.
- delete
- Delete given filesystem or data format (like partition table, RAID metadata, LUKS, physical volume metadata etc) on given devices.
list-supported
List supported filesystems, which can be used as lmi fs create <fstype> option.
Partition management.
Usage:
lmi partition list [ <device> ...]
lmi partition create [ –logical | –extended ] <device> [<size>]
lmi partition delete <partition> ...
lmi partition show [ <partition> ...]
Commands:
- list
- List available partitions on given devices. If no devices are provided, all partitions are listed.
- create
Create a partition on given device.
If no size is given, the resulting partition will occupy the largest available space on disk.
The command automatically creates extended and logical partitions using these rules:
- If no partition type (logical or extended) is provided and MS-DOS partition is requested and there is extended partition already on the device, a logical partition is created.
- If there is no extended partition on the device and there are at most two primary partitions on the device, primary partition is created.
- If there is no extended partition and three primary partitions already exist, new extended partition with all remaining space is created and a logical partition with requested size is created.
- delete
- Delete given partitions.
- show
- Show detailed information about given partitions. If no partitions are provided, all of them are displayed.
Options:
- size
- Size of the partition in sectors.
- –logical
- Override the automatic behavior and request logical partition.
- –extended
- Override the automatic behavior and request extended partition.
Partition management.
Usage:
lmi partition-table list [ <device> ...]
lmi partition-table create [ –gpt | –msdos ] <device> ...
lmi partition-table show [ <device> ...]
Commands:
- list
- List partition tables on given device. If no devices are provided, all partition tables are listed.
- create
- Create a partition table on given devices. The devices must be empty, i.e. must not have any partitions on them. GPT partition table is created by default.
- show
- Show detailed information about partition table on given devices. If no devices are provided, all of them are displayed.
MD RAID management.
Usage:
lmi raid list
lmi raid create [ –name=<name> ] <level> <device> ...
lmi raid delete <device> ...
lmi raid show [ <device> ...]
Commands:
- list
- List all MD RAID devices on the system.
- create
- Create MD RAID array with given RAID level from list of devices.
- delete
- Delete given MD RAID devices.
- show
- Show detailed information about given MD RAID devices. If no devices are provided, all MD RAID devices are displayed.
Logical Volume management.
Usage:
lmi lv list [ <vg> ...]
lmi lv create <vg> <name> <size>
lmi lv delete <lv> ...
lmi lv show [ <lv> ...]
Commands:
- list
- List available logical volumes on given volume groups. If no volume groups are provided, all logical volumes are listed.
- create
Create a logical volume on given volume group.
Size can be specified as number of extents using ‘e’ suffix, e.g. ‘100e’ is 100 extents.
- delete
- Delete given logical volume.
- show
- Show detailed information about given Logical Volumes. If no Logical Volumes are provided, all of them are displayed.
Volume Group management.
Usage:
lmi vg list
lmi vg create [ –extent-size=<size> ] <name> <device> ...
lmi vg delete <vg> ...
lmi vg show [ <vg> ...]
Commands:
- list
- List all volume groups on the system.
- create
- Create Volume Group with given name from list of devices.
- delete
- Delete given Volume Groups.
- show
- Show detailed information about given Volume Groups. If no Volume Groups are provided, all of them are displayed.
Basic storage device information.
Usage:
lmi storage list [ <device> ...]
lmi storage depends [ –deep ] [ <device> ...]
lmi storage provides [ –deep ] [ <device> ...]
lmi storage show [ <device> ...]
lmi storage tree [ <device> ]
Commands:
- list
- List short information about given device. If no devices are given, all devices are listed.
- show
- Show detailed information about given devices. If no devices are provided, all of them are displayed.
- provides
Show devices, which are created from given devices (= show children of the devices).
For example, if disk is provided, all partitions on it are returned. If ‘deep’ is used, all RAIDs, Volume Groups and Logical Volumes indirectly allocated from it are returned too.
- depends
Show devices, which are required by given devices to operate correctly (= show parents of the devices).
For example, if a Logical Volume is provided, its Volume Group is returned. If ‘deep’ is used, also all Physical Volumes and disk are returned.
- tree
Show tree of devices, similar to lsblk. (Note that the output is really crude and needs to be worked on).
If no device is provided, all devices are shown, starting with physical disks.
If a device is provided, tree starts with the device and all dependent devices are shown.
Mounting management functions.
Usage:
lmi mount list [ –all ]
lmi mount create <device> <mountpoint> [ (-t <fs_type>) (-o <options>) (-p <other_options>) ]
lmi mount delete <target>
lmi mount show [ –all ]
Commands:
- list
- List mounted filesystems with a device attached to them. Optionally, show all mounted filesystems.
- create
Mount a specified device on the path given by mountpoint. Optionally, filesystem type, common options (filesystem independent) and filesystem specific options can be provided. If no filesystem type is specified, it is automatically detected.
Common options can be provided as a comma-separated string of ‘option_name:value’ items. Possible option names are:
AllowExecution AllowMandatoryLock AllowSUID AllowUserMount AllowWrite Auto Dump FileSystemCheckOrder InterpretDevices OtherOptions Silent SynchronousDirectoryUpdates SynchronousIO UpdateAccessTimes UpdateDirectoryAccessTimes UpdateFullAccessTimes UpdateRelativeAccessTimes
Possible option values for all of the options except for FileSystemCheckOrder are ‘t’, ‘true’, ‘f’, ‘false’. All of them are case insensitive. The FileSystemCheckOrder option’s value is a number.
Other options can be specified as a string.
Examples:
create /dev/vda1 /mnt -t ext4 -o ‘AllowWrite:F,InterpretDevices:false’
create /dev/vda2 /mnt -o ‘FileSystemCheckOrder:2’
create /dev/vda3 /mnt -p ‘user_xattr,barrier=0’
create /dev/vda4 /mnt -o ‘Dump:t, AllowMandatoryLock:t’ -p ‘acl’
- delete
- Unmount a mounted filesystem. Can be specified either as a device path or a mountpoint.
- show
- Show detailed information about mounted filesystems with a device attached to them. Optionally, show all mounted filesystems.