salt.modules.mdadm_raid
Salt module to manage RAID arrays with mdadm
-
Add new device to RAID array.
CLI Example:
salt '*' raid.add /dev/md0 /dev/sda1
salt.modules.mdadm_raid.add(name, device)
-
Assemble a RAID device.
CLI Examples:
salt '*' raid.assemble /dev/md0 ['/dev/xvdd', '/dev/xvde']
Note
Adding
test_mode=True
as an argument will print out the mdadm command that would have been run.- name
-
The name of the array to assemble.
- devices
-
The list of devices comprising the array to assemble.
- kwargs
-
Optional arguments to be passed to mdadm.
- returns
-
- test_mode=True:
-
Prints out the full command.
- test_mode=False (Default):
-
Executes command on the host(s) and prints out the mdadm output.
For more info, read the
mdadm
manpage.
salt.modules.mdadm_raid.assemble(name, devices, test_mode=False, **kwargs)
-
Create a RAID device.
Changed in version 2014.7.0.
Warning
Use with CAUTION, as this function can be very destructive if not used properly!
CLI Examples:
salt '*' raid.create /dev/md0 level=1 chunk=256 devices="['/dev/xvdd', '/dev/xvde']" test_mode=True
Note
Adding
test_mode=True
as an argument will print out the mdadm command that would have been run.- name
-
The name of the array to create.
- level
-
The RAID level to use when creating the raid.
- devices
-
A list of devices used to build the array.
- metadata
-
Version of metadata to use when creating the array.
- kwargs
-
Optional arguments to be passed to mdadm.
- returns
-
- test_mode=True:
-
Prints out the full command.
- test_mode=False (Default):
-
Executes command on remote the host(s) and Prints out the mdadm output.
Note
It takes time to create a RAID array. You can check the progress in "resync_status:" field of the results from the following command:
salt '*' raid.detail /dev/md0
For more info, read the
mdadm(8)
manpage
salt.modules.mdadm_raid.create(name, level, devices, metadata='default', test_mode=False, **kwargs)
-
Destroy a RAID device.
WARNING This will zero the superblock of all members of the RAID array..
CLI Example:
salt '*' raid.destroy /dev/md0
salt.modules.mdadm_raid.destroy(device)
-
Show detail for a specified RAID device
CLI Example:
salt '*' raid.detail '/dev/md0'
salt.modules.mdadm_raid.detail(device='/dev/md0')
-
Show detail for a specified RAID component device
- device
-
Device to examine, that is part of the RAID
- quiet
-
If the device is not part of the RAID, do not show any error
CLI Example:
salt '*' raid.examine '/dev/sda1'
salt.modules.mdadm_raid.examine(device, quiet=False)
-
List the RAID devices.
CLI Example:
salt '*' raid.list
salt.modules.mdadm_raid.list_()
-
Save RAID configuration to config file.
Same as: mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Fixes this issue with Ubuntu REF: http://askubuntu.com/questions/209702/why-is-my-raid-dev-md1-showing-up-as-dev-md126-is-mdadm-conf-being-ignored
CLI Example:
salt '*' raid.save_config
salt.modules.mdadm_raid.save_config()
-
Shut down all arrays that can be shut down (i.e. are not currently in use).
CLI Example:
salt '*' raid.stop
salt.modules.mdadm_raid.stop()
© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.mdadm_raid.html