]> git.ipfire.org Git - thirdparty/mdadm.git/blame - mdmon.8
main: factor out code to parse layout for raid10 and faulty.
[thirdparty/mdadm.git] / mdmon.8
CommitLineData
7675959b 1.\" See file COPYING in distribution for details.
222a7bfd 2.TH MDMON 8 "" v3.0-rc1
7675959b
DW
3.SH NAME
4mdmon \- monitor MD external metadata arrays
5
6.SH SYNOPSIS
7
8.BI mdmon " CONTAINER [NEWROOT]"
9
10.SH OVERVIEW
11The 2.6.27 kernel brings the ability to support external metadata arrays.
12External metadata implies that user space handles all updates to the metadata.
13The kernel's responsibility is to notify user space when a "metadata event"
14occurs, like disk failures and clean-to-dirty transitions. The kernel, in
15important cases, waits for user space to take action on these notifications.
16
17.SH DESCRIPTION
18.P
19.B Metadata updates:
20.P
21To service metadata update requests a daemon, mdmon, is introduced.
22Mdmon is tasked with polling the sysfs namespace looking for changes in
23.BR array_state ,
24.BR sync_action ,
25and per disk
26.BR state
27attributes. When a change is detected it calls a per metadata type
28handler to make modifications to the metadata. The following actions
29are taken:
30.RS
31.TP
32.B array_state \- inactive
33Clear the dirty bit for the volume and let the array be stopped
34.TP
35.B array_state \- write pending
36Set the dirty bit for the array and then set
37.B array_state
38to
39.BR active .
40Writes
41are blocked until userspace writes
42.BR active.
43.TP
44.B array_state \- active-idle
45The safe mode timer has expired so set array state to clean to block writes to the array
46.TP
47.B array_state \- clean
48Clear the dirty bit for the volume
49.TP
50.B array_state \- read-only
51This is the initial state that all arrays start at. mdmon takes one of the three actions:
52.RS
53.TP
541/
55Transition the array to read-auto keeping the dirty bit clear if the metadata
56handler determines that the array does not need resyncing or other modification
57.TP
582/
59Transition the array to active if the metadata handler determines a resync or
60some other manipulation is necessary
61.TP
623/
63Leave the array read\-only if the volume is marked to not be monitored; for
64example, the metadata version has been set to "external:\-dev/md127" instead of
65"external:/dev/md127"
66.RE
67.TP
68.B sync_action \- resync\-to\-idle
69Notify the metadata handler that a resync may have completed. If a resync
70process is idled before it completes this event allows the metadata handler to
71checkpoint resync.
72.TP
73.B sync_action \- recover\-to\-idle
74A spare may have completed rebuilding so tell the metadata handler about the
75state of each disk. This is the metadata handler’s opportunity to clear any
76"out-of-sync" bits and clear the volume’s degraded status. If a recovery
77process is idled before it completes this event allows the metadata handler to
78checkpoint recovery.
79.TP
80.B <disk>/state \- faulty
81A disk failure kicks off a series of events. First, notify the metadata
82handler that a disk has failed, and then notify the kernel that it can unblock
83writes that were dependent on this disk. After unblocking the kernel this disk
84is set to be removed* from the member array. Finally the disk is marked failed
85in all other member arrays in the container.
86.IP
87\* Note This behavior differs slightly from native MD arrays where
88removal is reserved for a
89.B mdadm --remove
90event. In the external metadata case the container holds the final
91reference on a block device and a
92.B mdadm --remove <container> <victim>
93call is still required.
94.RE
95
96.P
97.B Containers:
98.P
99External metadata formats, like DDF, differ from the native MD metadata
100formats in that they define a set of disks and a series of sub-arrays
101within those disks. MD metadata in comparison defines a 1:1
102relationship between a set of block devices and a raid array. For
103example to create 2 arrays at different raid levels on a single
104set of disks, MD metadata requires the disks be partitioned and then
105each array can created be created with a subset of those partitions. The
106supported external formats perform this disk carving internally.
107.P
108Container devices simply hold references to all member disks and allow
109tools like mdmon to determine which active arrays belong to which
110container. Some array management commands like disk removal and disk
111add are now only valid at the container level. Attempts to perform
112these actions on member arrays are blocked with error messages like:
113.IP
114"mdadm: Cannot remove disks from a \'member\' array, perform this
115operation on the parent container"
116.P
117Containers are identified in /proc/mdstat with a metadata version string
118"external:<metadata name>". Member devices are identified by
119"external:/<container device>/<member index>", or "external:-<container
120device>/<member index>" if the array is to remain readonly.
121
122.SH OPTIONS
123.TP
124CONTAINER
125The
126.B container
127device to monitor. It can be a full path like /dev/md/container, a simple md
128device name like md127, or /proc/mdstat which tells mdmon to scan for
129containers and launch an mdmon instance for each one found.
130.TP
131[NEWROOT]
132In order to support an external metadata raid array as the rootfs mdmon needs
133to be started in the initramfs environment. Once the initramfs environment
134mounts the final rootfs mdmon needs to be restarted in the new namespace. When
135NEWROOT is specified mdmon will terminate any mdmon instances that are running
136in the current namespace, chroot(2) to NEWROOT, and continue monitoring the
137container.
138