ArticleslgStudy

computer science

Mdadm

Mdadm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Mdadm rather than just read about it. In short: mdadm is a Linux utility used to manage and monitor software RAID devices. It is used in modern Linux distributions in place of older software RAID utilities such as raidtools2 or raidtools. mdadm is free software originally maintained by, and copyrighted to, Neil Brown of SUSE, and licensed under the terms of version 2 or later of the GNU General Public License.

Key takeaways

  • Mdadm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Mdadm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Mdadm from memory before moving on to harder problems.

Reference excerpt

mdadm is a Linux utility used to manage and monitor software RAID devices. It is used in modern Linux distributions in place of older software RAID utilities such as raidtools2 or raidtools. mdadm is free software originally maintained by, and copyrighted to, Neil Brown of SUSE, and licensed under the terms of version 2 or later of the GNU General Public License.

Name The name is derived from the md (multiple device) device nodes it administers or manages, and was previously known as mdctl. The original name was "Mirror Disk", but was changed as more functions were added. The name is now understood to be short for Multiple Disk and Device Management.

Overview Linux software RAID configurations can include anything presented to the Linux kernel as a block device. This includes whole hard drives (for example, /dev/sda), and their partitions (for example, /dev/sda1).

RAID configurations

RAID 0 – Block-level striping. MD can handle devices of different lengths, the extra space on the larger device is then not striped. RAID 1 – Mirror. RAID 4 – Like RAID 0, but with an extra device for the parity. RAID 5 – Like RAID 4, but with the parity distributed across all devices. RAID 6 – Like RAID 5, but with two parity segments per stripe. RAID 10 – Take a number of RAID 1 mirrorsets and stripe across them RAID 0 style. RAID 10 is distinct from RAID 0+1, which consists of a top-level RAID 1 mirror composed of high-performance RAID 0 stripes directly across the physical hard disks. A single-drive failure in a RAID 10 configuration results in one of the lower-level mirrors entering degraded mode, but the top-level stripe performing normally (except for the performance hit). A single-drive failure in a RAID 0+1 configuration results in one of the lower-level stripes completely failing, and the top-level mirror entering degraded mode. Which of the two setups is preferable depends on the details of the application in question, such as whether or not spare disks are available, and how they should be spun up.

Non-RAID configurations Linear – concatenates a number of devices into a single large MD device – (deprecated since 2021 and removed from the Linux kernel since 2023 ) Multipath – provides multiple paths with failover to a single device Faulty – a single device which emulates a number of disk-fault scenarios for testing and development Container – a group of devices managed as a single device, in which one can build RAID systems

Features The original (standard) form of names for md devices is /dev/md<n>, where <n> is a number between 0 and 99. More recent kernels have support for names such as /dev/md/Home. Under 2.4.x kernels and earlier these two were the only options. Both of them are non-partitionable. Since 2.6.x kernels, a new type of MD device was introduced, a partitionable array. The device names were modified by changing md to md_d. The partitions were identified by adding p<n>, where <n> is the partition number; thus /dev/md/md_d2p3 for example. Since version 2.6.28 of the Linux kernel mainline, non-partitionable arrays can be partitioned, the partitions being referred to in the same way as for partitionable arrays – for example, /dev/md/md1p2. Since version 3.7 of the Linux kernel mainline, md supports TRIM operations for the underlying solid-state drives (SSDs), for linear, RAID 0, RAID 1, RAID 5 and RAID 10 layouts.

Booting Since support for MD is found in the kernel, there is an issue with using it before the kernel is running. Specifically it will not be present if the boot loader is either (e)LiLo or GRUB legacy. Although normally present, it may not be present for GRUB 2. In order to circumvent this problem a /boot filesystem must be used either without md support, or else with RAID1. In the latter case the system will boot by treating the RAID1 device as a normal filesystem, and once the system is running it can be remounted as md and the second disk added to it. This will result in a catch-up, but /boot filesystems are usually small.

External metadata Besides its own formats for RAID volumes metadata, Linux software RAID also supports external metadata formats, since version 2.6.27 of the Linux kernel and version 3.0 of the mdadm userspace utility. This allows Linux to use various firmware- or driver-based RAID volumes, also known as "fake RAID". As of October 2013, there are two supported formats of the external metadata:

DDF (Disk Data Format), an industry standard defined by the Storage Networking Industry Association for increased interoperability. Volume metadata format used by the Intel Rapid Storage Technology(RST), former Intel Matrix RAID, implemented on many consumer-level motherboards.

mdmpd mdmpd was a daemon used for monitoring MD multipath devices up to Linux kernel 2.6.10-rc1, developed by Red Hat as part of the mdadm package. The program was used to monitor multipath (RAID) devices, and is usually started at boot time as a service, and afterwards running as a daemon. Enterprise storage requirements often include the desire to have more than one way to talk to a single disk drive so that in the event of some failure to talk to a disk drive via one controller, the system can automatically switch to another controller and keep going. This is called multipath disk access. The linux kernel implements multipath disk access via the software RAID stack known as the md (Multiple Devices) driver. The kernel portion of the md multipath driver only handles routing I/O requests to the proper device and handling failures on the active path. It does not try to find out if a path that has previously failed might be working again. That's what this daemon does. Upon startup, it reads the current state of the md raid arrays, saves that state, and then waits for the kernel to tell it something interesting has happened. It then wakes up, checks to see if any paths on a multipath device have failed, and if they have then it starts to poll the failed path once every 15 seconds until it starts working again. Once it starts working again, the daemon will then add the path back into the multipath md device it was originally part of as a new spare path. If one is using the /proc filesystem, /proc/mdstat lists all active md devices with information about them. Mdmpd requires this to find arrays to monitor paths on, to get notification of interesting events and to monitor array reconstruction on Monitor mode.

Technical details RAID 1

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Mdadm

Start with the simplest possible case. Write down what Mdadm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Mdadm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Mdadm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Mdadm

In research
Mdadm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Mdadm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Mdadm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Free software programmed in C, Free system software, Linux file system-related software, so understanding it makes those chapters shorter.
In everyday life
Look for Mdadm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Mdadm” →

How to study Mdadm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Mdadm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Mdadm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Mdadm in simple terms?

mdadm is a Linux utility used to manage and monitor software RAID devices. It is used in modern Linux distributions in place of older software RAID utilities such as raidtools2 or raidtools. mdadm is free software originally maintained by, and copyrighted to, Neil Brown of SUSE, and licensed under…

Why does Mdadm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Mdadm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Mdadm.

Tags

  • Free software programmed in C
  • Free system software
  • Linux file system-related software
  • RAID
  • Software using the GNU General Public License

Keep exploring