salt.modules.mdadm

Salt module to manage RAID arrays with mdadm

salt.modules.mdadm.create(*args)

Create a RAID device.

Warning

Use with CAUTION, as this function can be very destructive if not used properly!

Use this module just as a regular mdadm command.

For more info, read the mdadm(8) manpage

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

CLI Examples:

salt '*' raid.create /dev/md0 level=1 chunk=256 raid-devices=2 /dev/xvdd /dev/xvde test_mode=True

Note

Test mode

Adding test_mode=True as an argument will print out the mdadm command that would have been run.

Parameters:
  • args -- The arguments u pass to this function.
  • arguments -- arguments['new_array']: The name of the new RAID array that will be created. arguments['opt_val']: Option with Value. Example: raid-devices=2 arguments['opt_raw']: Option without Value. Example: force arguments['disks_to_array']: The disks that will be added to the new raid.
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.

salt.modules.mdadm.destroy(device)

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.detail(device='/dev/md0')

Show detail for a specified RAID device

CLI Example:

salt '*' raid.detail '/dev/md0'
salt.modules.mdadm.list_()

List the RAID devices.

CLI Example:

salt '*' raid.list