Automatic Drive Replacement

A drive can be automatically replaced after it

  • failed (was physically removed from a RAID);
  • exceeded the threshold value of I/O errors (the default is 3. To change the threshold, use the command xicli settings faulty-count modify --threshold).

To automatically replace drives on a RAID, create a spare pool, then assign the created spare pool to the RAID. You can only assign one spare pool to each RAID. We recommend creating a sparepool with storage devices of the same type.

If the system has a spare pool, you can assign it to an existing RAID or when creating a new RAID using the commands xicli raid create/modify --sparepool.

Commands for managing spare pools

To add drive(s) to the spare pool, run

# xicli pool add <args>
Table 1. Arguments for the add subcommand

Required arguments

-n

--name

The name of the spare pool.

-d

--drives

The list of block devices (/dev/sd*, /dev/mapper/mpath*, /dev/nvme*, /dev/dm-*) separated by a space.

To create the spare pool, run

# xicli pool create <args>
Table 2. Arguments for the create subcommand

Required arguments

-n

--name

The name for the spare pool.

-d

--drives

The list of block devices (/dev/sd*, /dev/mapper/mpath*, /dev/nvme*, /dev/dm-*) separated by a space.

To delete the spare pool, run

# xicli pool delete <arg>
Table 3. Argument for the delete subcommand

Required argument

-n

--name

The name of the spare pool.

To remove drive(s) from the spare pool, run

# xicli pool remove <args>
Table 4. Arguments for the remove subcommand

Required arguments

-n

--name

The name of the spare pool.

-d

--drives

The list of block devices (/dev/sd*, /dev/mapper/mpath*, /dev/nvme*, /dev/dm-*) separated by a space.

To show info on the spare pool, run

# xicli pool show [optional_args]
Table 5. Arguments for the show subcommand

Optional arguments

-n

--name

The name of the spare pool.

Without the argument, show info on all spare pools.

-f

--format

Output format:

  • table;
  • json;
  • prettyjson – human-readable json.

The default: table.

-u

--units

Size units:

  • s – sectors (1 sector=512 bytes);
  • k – kilobytes;
  • m – megabytes;
  • g – gigabytes.

The default: g.


xicli pool show output example

Possible drive states:

  • ready – the drive is able for replacement;
  • absent – drive is missing in the system;
  • failed – attempt to replace with this drive from the spare pool failed, the drive will not be used for replacement.

To manage delay timer for the drive replacement from the spare pools, run

# xicli settings pool modify <arg>
Attention:

When you change any parameter of the xicli settings pool modify command, the xiraid-scanner.service restarts.

Table 6. Argument for the pool modify subcommand

Required argument

-rd

--replace_delay

Delay time (in seconds) for the drive replacement from the spare pools.

Only one delay time is used for all the spare pools.

Possible values: integers from 1 to 3600.

The default: 180.

To show delay time used for the drive replacement from the spare pools, run

# xicli settings pool show
Table 7. Argument for the pool show subcommand

Optional argument

-f

--format

Output format:

  • table;
  • json;
  • prettyjson – human-readable json.

The default: table.

Example: Creating a sparepool “pool1” and assigning it to the RAID “media5”:
  1. Create a sparepool:

    # xicli pool create -n pool1 -d /dev/sda /dev/sdb
  2. Assign the created sparepool to the RAID:

    # xicli raid modify -n media5 -sp pool1

Example: Setting the replacement timer for the sparepools to 60 seconds:

# xicli settings pool modify -rd 60