Since salt now also supports LV extend and reduce, the option Force must be used with care. The changes include that force is only set if the corresponding LV does not yet exist (check via Grains) in order to overwrite any FS signatures (Wiping fs signature). If the LV already exists (check via Grains), Force is set to False unless this is explicitly set to True in the pillars.pull/221/head
journal: | journal: | ||||
SystemMaxUse: "50M" | SystemMaxUse: "50M" | ||||
RuntimeMaxFiles: "100" | RuntimeMaxFiles: "100" | ||||
Ensure presence of directory: | Ensure presence of directory: | ||||
.. code-block:: yaml | .. code-block:: yaml | ||||
size: 40G | size: 40G | ||||
mount: ${linux:storage:mount:data} | mount: ${linux:storage:mount:data} | ||||
Salt now also supports expanding and shrinking a LV: | |||||
To reduce the size of an LV the option force must be set to true. | |||||
! Caution this can destroy the file system if it is not shrunk before ! | |||||
only some file systems can be shrunk. | |||||
.. code-block:: yaml | |||||
parameters: | |||||
linux: | |||||
lvm: | |||||
vg1: | |||||
enabled: true | |||||
devices: | |||||
- /dev/sdb | |||||
volume: | |||||
data: # to expand | |||||
size: 50G | |||||
mount: ${linux:storage:mount:data} | |||||
data: # to reduce | |||||
size: 30G | |||||
force: true | |||||
mount: ${linux:storage:mount:data} | |||||
Create partitions on disk. Specify size in MB. It expects empty | Create partitions on disk. Specify size in MB. It expects empty | ||||
disk without any existing partitions. | disk without any existing partitions. | ||||
Set ``startsector=1`` if you want to start partitions from ``2048``. | Set ``startsector=1`` if you want to start partitions from ``2048``. | ||||
* #salt-formulas @ irc.freenode.net | * #salt-formulas @ irc.freenode.net | ||||
Use this IRC channel in case of any questions or feedback which is always | Use this IRC channel in case of any questions or feedback which is always | ||||
welcome. | welcome. | ||||
- name: {{ volume.get('name', lvname) }} | - name: {{ volume.get('name', lvname) }} | ||||
- vgname: {{ vg.get('name', vgname) }} | - vgname: {{ vg.get('name', vgname) }} | ||||
- size: {{ volume.size }} | - size: {{ volume.size }} | ||||
- force: true | |||||
{%- if (volume.force is defined and volume.force is sameas true) or | |||||
(volume.get('name', lvname) not in grains.lvm[vg.get('name', vgname)]) %} | |||||
- force: True | |||||
{%- else %} | |||||
- force: False | |||||
{%- endif %} | |||||
- require: | - require: | ||||
- lvm: lvm_vg_{{ vg.get('name', vgname) }} | - lvm: lvm_vg_{{ vg.get('name', vgname) }} | ||||
{%- if volume.mount is defined %} | |||||
{%- if (volume.mount is defined) and | |||||
(volume.get('name', lvname) not in grains.lvm[vg.get('name', vgname)]) %} | |||||
- require_in: | - require_in: | ||||
- mount: {{ volume.mount.path }} | - mount: {{ volume.mount.path }} | ||||
{%- if not volume.mount.get('file_system', None) in ['nfs', 'nfs4', 'cifs', 'tmpfs', None] %} | {%- if not volume.mount.get('file_system', None) in ['nfs', 'nfs4', 'cifs', 'tmpfs', None] %} |