Online Book Reader

Home Category

Managing RAID on Linux - Derek Vadala [73]

By Root 1340 0

-c, --config=

Specifies an alternate location for /etc/mdadm.conf. See the /etc/mdadm.conf section, later in this chapter, for more information.

-R, --run

Starts an array when possible, even if some of its member disks are missing or unavailable. This is useful for starting a RAID-1, RAID-4, or RAID-5 in degraded mode.

-f, --force

Starts an array even if the RAID superblocks found on member disks are inconsistent.

Example usage

Assemble the array named /dev/md1 from all disks whose names begin with /dev/sd and that bear the specified UUID:

# mdadm --assemble /dev/md1 --uuid=0bd9fe83:702b6f5e:ab4d0e06:7dd7dbf4 /dev/sd*

You can examine the first partition of SCSI disks A through Z for the array with UUID 0bd9fe83:702b6f5e:ab4d0e06:7dd7dbf4 and start it on /dev/md1:

# mdadm -A /dev/md1 -u0bd9fe83:702b6f5e:ab4d0e06:7dd7dbf4 /dev/sd[a-z]1

Search SCSI disks A through Z for member disks with the minor number 1 and combine them into /dev/md1:

# mdadm -A /dev/md1 --super-minor=1 /dev/sd[a-z]1

The following command looks in /etc/mdadm.conf for a list of devices to scan for the minor number 1 and the UUID 0bd9fe83:702b6f5e:ab4d0e06:7dd7dbf4. When both a UUID and a minor number are specified, both items must match the member disk for the disk to be considered an array component.

# mdadm -A /dev/md1 -m1 -u0bd9fe83:702b6f5e:ab4d0e06:7dd7dbf4

Combine the --scan option with the -A assemble option to activate an md device, using an array entry found in /etc/mdadm.conf:

# mdadm -A --scan /dev/md0

Start all arrays that have entries in /etc/mdadm.conf:

# mdadm -As

Refer to the /etc/mdadm.conf section, later in this chapter, for further information on how to create a configuration file and use it with assemble mode.

Name

Monitor mode

Synopsis

mdadm --monitor mddevice [options]

Monitor, or Follow, mode allows administrators to configure email notification, set up event handling, and share spare disks between arrays.

Options

-F, --follow, --monitor

Enables Follow mode for the specified array(s). mdadm will not exit when Follow mode is invoked. Instead, it polls arrays and monitors for critical events. Run mdadm in the background as necessary.

-m, --mail=

Sets the email address to notify when a failure event occurs. Example: -mderek or --mail=derek.

-p, --program=, --alert=

Executes the specified program when an event occurs. You can create homegrown scripts to help mdadm monitor and manage arrays. Examples of these options include -pmymdmonitor.sh or --program=/usr/local/sbin/mymdmonitor.pl.

-d, --delay=

Changes the number of seconds to wait between polling arrays (for example, -d30 or --delay=30 for thirty seconds). The default is one minute.

-s, --scan

When used in Monitor mode, consults /etc/mdadm.conf for a MAILADDR line that indicates where to email results, and for a PROGRAM line that indicates what program to run, instead of taking those pieces of information from the command line.

Example usage

When monitor mode is invoked, mdadm will not exit, so it's a good idea to run it in the background and redirect its output to a file that you can examine. The following example polls /dev/md1 every sixty seconds (the default) and sends critical event notifications to root:

# nohup mdadm --monitor /dev/md1 --mail=root &

If an md device is not specified on the command line, mdadm will monitor all devices listed in /etc/mdadm.conf. The next example monitors all arrays listed in the configuration and sends notifications to derek@azurance.com.

# nohup mdadm --monitor --mail=derek@azurance.com &

It's useful to invoke mdadm in monitor mode when the system boots. You can do this by creating an rc script for it at specific runlevels or adding it to /etc/rc.local where available. Chapter 7 covers practical usage of mdadm --monitor.

mdadm reports the following events via email:

Fail mddevice

A member disk that was part of mddevice has failed and was marked as faulty.

FailSpare mddevice spare-disk

The spare-disk that was added to mddevice failed before reconstruction completed.

Return Main Page Previous Page Next Page

®Online Book Reader