salt.modules.linux_lvm

Support for Linux LVM2

salt.modules.linux_lvm.fullversion()

Return all version info from lvm version

CLI 范例:

salt '*' lvm.fullversion
salt.modules.linux_lvm.lvcreate(lvname, vgname, size=None, extents=None, snapshot=None, pv=None, **kwargs)

Create a new logical volume, with option for which physical volume to be used

CLI范例:

salt '*' lvm.lvcreate new_volume_name vg_name size=10G
salt '*' lvm.lvcreate new_volume_name vg_name extents=100 pv=/dev/sdb
salt '*' lvm.lvcreate new_snapshot    vg_name snapshot=volume_name size=3G
salt.modules.linux_lvm.lvdisplay(lvname='')

Return information about the logical volume(s)

CLI范例:

salt '*' lvm.lvdisplay
salt '*' lvm.lvdisplay /dev/vg_myserver/root
salt.modules.linux_lvm.lvremove(lvname, vgname)

Remove a given existing logical volume from a named existing volume group

CLI 范例:

salt '*' lvm.lvremove lvname vgname force=True
salt.modules.linux_lvm.lvresize(size, lvpath)

Return information about the logical volume(s)

CLI范例:

salt '*' lvm.lvresize +12M /dev/mapper/vg1-test
salt.modules.linux_lvm.pvcreate(devices, override=True, **kwargs)

Set a physical device to be used as an LVM physical volume

override
Skip devices, if they are already an LVM physical volumes

CLI范例:

salt mymachine lvm.pvcreate /dev/sdb1,/dev/sdb2
salt mymachine lvm.pvcreate /dev/sdb1 dataalignmentoffset=7s
salt.modules.linux_lvm.pvdisplay(pvname='', real=False)

Return information about the physical volume(s)

pvname
physical device name
real

dereference any symlinks and report the real device

2015.8.7 新版功能.

CLI范例:

salt '*' lvm.pvdisplay
salt '*' lvm.pvdisplay /dev/md0
salt.modules.linux_lvm.pvremove(devices, override=True)

Remove a physical device being used as an LVM physical volume

override
Skip devices, if they are already not used as an LVM physical volumes

CLI范例:

salt mymachine lvm.pvremove /dev/sdb1,/dev/sdb2
salt.modules.linux_lvm.version()

Return LVM version from lvm version

CLI 范例:

salt '*' lvm.version
salt.modules.linux_lvm.vgcreate(vgname, devices, **kwargs)

Create an LVM volume group

CLI范例:

salt mymachine lvm.vgcreate my_vg /dev/sdb1,/dev/sdb2
salt mymachine lvm.vgcreate my_vg /dev/sdb1 clustered=y
salt.modules.linux_lvm.vgdisplay(vgname='')

Return information about the volume group(s)

CLI范例:

salt '*' lvm.vgdisplay
salt '*' lvm.vgdisplay nova-volumes
salt.modules.linux_lvm.vgextend(vgname, devices)

Add physical volumes to an LVM volume group

CLI范例:

salt mymachine lvm.vgextend my_vg /dev/sdb1,/dev/sdb2
salt mymachine lvm.vgextend my_vg /dev/sdb1
salt.modules.linux_lvm.vgremove(vgname)

Remove an LVM volume group

CLI范例:

salt mymachine lvm.vgremove vgname
salt mymachine lvm.vgremove vgname force=True