Ability to create partitions on empty disks. Change-Id: I0a71da9d62d8f7df3fa03e3f34d49bad6988ba6dpull/118/head
size: 40G | size: 40G | ||||
mount: ${linux:storage:mount:data} | mount: ${linux:storage:mount:data} | ||||
Create partitions on disk. Specify size in MB. It expects empty | |||||
disk without any existing partitions. | |||||
.. code-block:: yaml | |||||
linux: | |||||
storage: | |||||
disk: | |||||
first_drive: | |||||
name: /dev/loop1 | |||||
type: gpt | |||||
partitions: | |||||
- size: 200 #size in MB | |||||
type: fat32 | |||||
- size: 300 #size in MB | |||||
type: ext4 | |||||
/dev/vda1: | |||||
partitions: | |||||
- size: 5 | |||||
type: ext2 | |||||
- size: 10 | |||||
type: ext4 | |||||
Multipath with Fujitsu Eternus DXL | Multipath with Fujitsu Eternus DXL | ||||
{%- from "linux/map.jinja" import storage with context %} | |||||
{%- if storage.enabled %} | |||||
{%- for disk_name, disk in storage.disk.iteritems() %} | |||||
{%- if disk.type is defined %} | |||||
create_disk_label: | |||||
module.run: | |||||
- name: partition.mklabel | |||||
- device: {{ disk.name|default(disk_name) }} | |||||
- label_type: {{ disk.get('type', 'gpt') }} | |||||
- unless: fdisk -l | grep {{ disk.get('type', 'gpt') }} | |||||
{%- endif %} | |||||
{% set end_size = 0 -%} | |||||
{%- for partition in disk.get('partitions', []) %} | |||||
{%- if not salt['partition.exists'](disk.get('name', disk_name)+'p'~loop.index) %} | |||||
create_partition_{{ disk.name|default(disk_name) }}_{{ loop.index }}: | |||||
module.run: | |||||
- name: partition.mkpart | |||||
- device: {{ disk.name|default(disk_name) }} | |||||
- part_type: primary | |||||
- fs_type: {{ partition.type }} | |||||
- start: {{ end_size }}MB | |||||
- end: {{ end_size + partition.size }}MB | |||||
{%- endif %} | |||||
{% set end_size = end_size + partition.size -%} | |||||
{%- endfor %} | |||||
{%- endfor %} | |||||
{%- endif %} |
{%- from "linux/map.jinja" import storage with context %} | {%- from "linux/map.jinja" import storage with context %} | ||||
{%- if storage.mount|length > 0 or storage.swap|length > 0 or storage.multipath.enabled or storage.lvm|length > 0 or storage.loopback|length > 0 %} | |||||
{%- if storage.mount|length > 0 or storage.swap|length > 0 or storage.multipath.enabled or storage.disk|length > 0 or storage.lvm|length > 0 or storage.loopback|length > 0 %} | |||||
include: | include: | ||||
{%- if storage.loopback|length > 0 %} | {%- if storage.loopback|length > 0 %} | ||||
- linux.storage.loopback | - linux.storage.loopback | ||||
{%- endif %} | {%- endif %} | ||||
{%- if storage.disk|length > 0 %} | |||||
- linux.storage.disk | |||||
{%- endif %} | |||||
{%- if storage.lvm|length > 0 %} | {%- if storage.lvm|length > 0 %} | ||||
- linux.storage.lvm | - linux.storage.lvm | ||||
{%- endif %} | {%- endif %} |
device: /dev/vg0/lv03 | device: /dev/vg0/lv03 | ||||
path: /mnt/lv03 | path: /mnt/lv03 | ||||
file_system: xfs | file_system: xfs | ||||
disk1: | |||||
enabled: true | |||||
device: /dev/loop_dev4 | |||||
path: /tmp/dummy | |||||
file_system: xfs | |||||
options: "noatime,nobarrier,logbufs=8" | |||||
user: nobody | |||||
group: nogroup | |||||
mode: 755 | |||||
disk: | |||||
first_drive: | |||||
name: /tmp/loop_dev4 | |||||
type: gpt | |||||
partitions: | |||||
- size: 5 | |||||
type: fat32 | |||||
- size: 5 | |||||
type: fat32 |