Jump to content

Mdadm: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Citation bot (talk | contribs)
Added website. | Use this bot. Report bugs. | Suggested by LeapTorchGear | #UCB_webform 139/234
 
(44 intermediate revisions by 30 users not shown)
Line 1: Line 1:
{{Short description|Linux utility for managing software RAID}}
{{More footnotes|date=November 2011}}
{{More footnotes|date=November 2011}}
{{Lowercase title}}
{{Lowercase title}}
{{Infobox software
{{Infobox software
| name = mdadm
| name = mdadm
| author = Neil Brown
| author = Neil Brown
| developer = Community contributors, <br /> Mariusz Tkaczyk<ref>{{cite web | url = https://marc.info/?l=linux-raid&m=170256349004550&w=2 | title = Announcement: mdadm maintainer update | date = 2023-12-14 | accessdate = 2024-05-17 | publisher = marc.info }}</ref>
| developer = Jes Sorensen
| released = 2001
| released = 2001
| latest release version = 4.0<ref>{{cite web | url = https://www.kernel.org/pub/linux/utils/raid/mdadm/ANNOUNCE | title = ANNOUNCE: mdadm 4.0 - A tool for managing md Soft RAID under Linux | date = 2017-01-09 | access-date = 2017-12-26 | first = Jes | last = Sorensen }}</ref>
| latest release version = 4.3<ref>{{cite web | url = https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=d709d4161d1dd51a976147e8372fbd99ff8183bd | title = Release mdadm-4.3 | date = 2024-02-15}}</ref>
| latest release date = {{release date and age|2017|01|09}}
| latest release date = {{release date and age|2024|02|15}}
| repo = {{URL|https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/}}
| repo = {{URL|github.com/md-raid-utilities/mdadm/}}
| programming language = [[C (programming language)|C]]
| programming language = [[C (programming language)|C]]
| operating system = [[Linux]]
| operating system = [[Linux]]
| language = [[English language|English]]
| language = [[English language|English]]
| genre = Disk utility
| status = Active
| license = [[GNU GPL]]
| genre = Disk utility
| license = [[GNU GPL]]
| website = {{URL|http://neil.brown.name/blog/mdadm}}
}}
}}


'''mdadm''' is a [[Linux]] utility used to manage and monitor [[software RAID]] devices. It is used in modern [[GNU/Linux distribution]]s in place of older software RAID utilities such as [[raidtools2]] or [[raidtools]].<ref name="lpic-2">{{cite book|url=https://books.google.co.uk/books?redir_esc=y&id=YBktDQAAQBAJ&dq=%22mdadm%22+%22linux%22&q=mdadm#v=snippet&q=mdadm&f=false|pages=206-221|title=LPIC-2: Linux Professional Institute Certification Study Guide|publisher=[[John Wiley & Sons]]|first1=Christine|last1=Bresnahan|first2=Richard|last2=Blum|year=2016|isbn=9781119150817}}</ref><ref>{{cite book|url=https://books.google.co.uk/books?id=EbWbAgAAQBAJ&pg=PT151&dq=%22mdadm%22+%22linux%22&hl=en&sa=X&redir_esc=y#v=onepage&q=%22mdadm%22%20%22linux%22&f=false|title=Managing RAID on Linux|first=Derek|last=Vadala|publisher=O'Reilly Media, Inc|year=2003|isbn=9781565927308}}</ref><ref>{{cite book|url=https://books.google.co.uk/books?id=0SIdBAAAQBAJ&pg=PA244&dq=%22mdadm%22+%22linux%22&hl=en&sa=X&redir_esc=y#v=onepage&q=%22mdadm%22%20%22linux%22&f=false|title=UNIX and Linux System Administration Handbook|first=Evi|last=Nemeth|pages=242-245|isbn=9780131480056|publisher=Pearson Education|year=2011}}</ref>
'''mdadm''' is a [[Linux]] utility used to manage and monitor [[software RAID]] devices. It is used in modern [[Linux distribution]]s in place of older software RAID utilities such as [[raidtools2]] or [[raidtools]].<ref name="lpic-2">{{cite book|url=https://books.google.com/books?id=YBktDQAAQBAJ&q=mdadm|pages=206–221|title=LPIC-2: Linux Professional Institute Certification Study Guide|publisher=[[John Wiley & Sons]]|first1=Christine|last1=Bresnahan|first2=Richard|last2=Blum|year=2016|isbn=9781119150817}}</ref><ref>{{cite book|url=https://archive.org/details/managingraidonli0000vada|url-access=registration|page=[https://archive.org/details/managingraidonli0000vada/page/140 140]|quote=mdadm linux.|title=Managing RAID on Linux|first=Derek|last=Vadala|publisher=O'Reilly Media, Inc|year=2003|isbn=9781565927308}}</ref><ref>{{cite book|url=https://books.google.com/books?id=0SIdBAAAQBAJ&q=%22mdadm%22+%22linux%22&pg=PA244|title=UNIX and Linux System Administration Handbook|first=Evi|last=Nemeth|pages=242–245|isbn=9780131480056|publisher=Pearson Education|year=2011}}</ref>


mdadm is [[free software]] maintained by, and copyrighted to, Neil Brown of [[The Attachmate Group|SUSE]], and licensed under the terms of version 2 or later of the [[GNU General Public License]].
mdadm is [[free software]] originally<ref>{{Cite web|url=http://neil.brown.name/blog/mdadm|title=Mdadm|access-date=2007-08-25|archive-date=2013-05-03|archive-url=https://web.archive.org/web/20130503183707/http://neil.brown.name/blog/mdadm|url-status=dead}}</ref> maintained by, and copyrighted to, Neil Brown of [[SUSE S.A.|SUSE]], and licensed under the terms of version&nbsp;2 or later of the [[GNU General Public License]].


==Name==
==Name==
Line 32: Line 31:
{{See also|Linux MD RAID 10}}
{{See also|Linux MD RAID 10}}


* ''RAID 0'' – Block level [[Data striping|striping]]. MD can handle devices of different lengths, the extra space on the larger device is then not striped.
* ''RAID 0'' – Block-level [[Data striping|striping]]. MD can handle devices of different lengths, the extra space on the larger device is then not striped.
* ''RAID 1'' – Mirror.
* ''RAID 1'' – Mirror.
* ''RAID 4'' – Like RAID 0, but with an extra device for the [[parity bit|parity]].
* ''RAID 4'' – Like RAID 0, but with an extra device for the [[parity bit|parity]].
Line 42: Line 41:


=== Non-RAID configurations ===
=== Non-RAID configurations ===
* ''Linear'' &ndash; concatenates a number of devices into a single large MD device &ndash; (deprecated since 2021 and removed from the Linux kernel since 2023 <ref name="linux-linear-removal">{{cite web | url = https://github.com/torvalds/linux/commit/849d18e27be9a1253f2318cb4549cc857219d991 | title = md: Remove deprecated CONFIG_MD_LINEAR | website = [[GitHub]] | date = 2023-12-19 | accessdate = 2024-04-30 }}</ref>)
* ''Linear'' – concatenates a number of devices into a single large MD device.
* ''Multipath'' – provides multiple paths with failover to a single device.
* ''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.
* ''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.
* ''Container'' – a group of devices managed as a single device, in which one can build RAID systems


== Features ==
== Features ==
Line 52: Line 51:
Since 2.6.x kernels, a new type of MD device was introduced, a [[Partition (computing)|partitionable]] array. The device names were modified by changing {{mono|md}} to {{mono|md_d}}. The partitions were identified by adding {{mono|p<n>}}, where {{mono|<n>}} is the partition number; thus {{mono|/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{{snd}} for example, {{mono|/dev/md/md1p2}}.
Since 2.6.x kernels, a new type of MD device was introduced, a [[Partition (computing)|partitionable]] array. The device names were modified by changing {{mono|md}} to {{mono|md_d}}. The partitions were identified by adding {{mono|p<n>}}, where {{mono|<n>}} is the partition number; thus {{mono|/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{{snd}} for example, {{mono|/dev/md/md1p2}}.


Since version 3.7 of the Linux kernel mainline, md supports [[TRIM]] operations for the underlying [[solid-state drive]]s (SSDs), for linear, RAID&nbsp;0, RAID&nbsp;1, RAID&nbsp;5 and RAID&nbsp;10 layouts.<ref>{{cite web
Since version 3.7 of the Linux kernel mainline, md supports [[Trim (computing)|TRIM]] operations for the underlying [[solid-state drive]]s (SSDs), for linear, RAID&nbsp;0, RAID&nbsp;1, RAID&nbsp;5 and RAID&nbsp;10 layouts.<ref>{{cite web
| url = http://kernelnewbies.org/Linux_3.7#head-2fd9b183a4623d96e69ed24f88e0eb83217fa8df
| url = http://kernelnewbies.org/Linux_3.7#head-2fd9b183a4623d96e69ed24f88e0eb83217fa8df
| title = Linux kernel 3.7, Section 5. Block
| title = Linux kernel 3.7, Section 5. Block
Line 70: Line 69:


* DDF ([[Disk Data Format]]), an industry standard defined by the [[Storage Networking Industry Association]] for increased interoperability.<ref>{{cite web | url = https://raid.wiki.kernel.org/index.php/DDF_Fake_RAID | title = DDF Fake RAID | work = RAID Setup | date = 2013-09-12 | accessdate = 2014-01-01 | publisher = kernel.org }}</ref>
* DDF ([[Disk Data Format]]), an industry standard defined by the [[Storage Networking Industry Association]] for increased interoperability.<ref>{{cite web | url = https://raid.wiki.kernel.org/index.php/DDF_Fake_RAID | title = DDF Fake RAID | work = RAID Setup | date = 2013-09-12 | accessdate = 2014-01-01 | publisher = kernel.org }}</ref>
* Volume metadata format used by the [[Intel Matrix RAID]], implemented on many consumer-level motherboards.<ref name="linux-kernel-raid" />
* Volume metadata format used by the [[Intel Rapid Storage Technology]](RST), former Intel Matrix RAID, implemented on many consumer-level motherboards.<ref name="linux-kernel-raid" />


=== mdmpd ===
=== mdmpd ===
'''mdmpd''' is a [[daemon (computer software)|daemon]] used for monitoring MD multipath devices, developed by [[Red Hat]] as part of the mdadm package.<ref>{{cite web | url = https://rhn.redhat.com/errata/RHEA-2003-397.html | title = Updated mdadm package includes multi-path device enhancements | date = 2004-01-16 | work = RHEA-2003:397-06 | publisher = [[Redhat]]}}</ref> The program is used to monitor multipath ([[RAID]]) devices, and is usually started at boot time as a service, and afterwards running as a daemon.
'''mdmpd''' was<ref>{{Cite web|url=https://bugzilla.redhat.com/show_bug.cgi?id=117498|title = 117498 – md code missing event interface}}</ref> a [[daemon (computer software)|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.<ref>{{cite web | url = https://rhn.redhat.com/errata/RHEA-2003-397.html | title = Updated mdadm package includes multi-path device enhancements | date = 2004-01-16 | work = RHEA-2003:397-06 | publisher = [[Redhat]]}}</ref> The program was used to monitor [[wikt:multipath|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.
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 {{mono|/[[proc]]}} filesystem, {{mono|/proc/mdstat}} lists all active md devices with information about them. Mdmpd requires this to find arrays to monitor paths on and to get notification of interesting events.
If one is using the {{mono|/[[procfs|proc]]}} filesystem, {{mono|/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.<ref>{{Cite web|url=https://linux.die.net/man/8/mdadm|title=Mdadm(8): Manage MD devices aka Software RAID - Linux man page}}</ref>

=== Technical details RAID 1 ===
{{unsourced section|date=November 2023}}
The data on a RAID 1 volume is the same as on a normal partition. The RAID information is stored in the last 128kB of the partition. This means, to convert a RAID 1 volume to normal data partition, it is possible to decrease the partition size by 128kB and change the partition ID from fd to 83 (for Linux).


== See also ==
== See also ==
{{Portal|Free and open-source software|Linux}}
{{Portal|Free and open-source software|Linux}}
* [[Software RAID]]
* [[bioctl]] on OpenBSD/NetBSD
* [[bioctl]] on OpenBSD/NetBSD


Line 90: Line 92:
{{Wikiversity|mdadm quick reference}}
{{Wikiversity|mdadm quick reference}}


* [https://raid.wiki.kernel.org/ Linux RAID Wiki]
* [https://www.kernel.org/pub/linux/utils/raid/mdadm/ mdadm source code releases]
* {{cite web | url = http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=blob;f=debian/README.recipes;hb=HEAD | archive-url = https://archive.is/20130704000938/http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=blob;f=debian/README.recipes;hb=HEAD | url-status = dead | archive-date = 2013-07-04 | title = mdadm recipes | first = Martin F. | last = Krafft | work = [[Debian]] }}
* {{cite web | url = http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch26_:_Linux_Software_RAID | title = Quick HOWTO: Ch26: Linux Software RAID | publisher = linuxhomenetworking.com}}
* {{cite web | url = https://help.ubuntu.com/community/Installation/SoftwareRAID | title = Installation/SoftwareRAID | work = [[Ubuntu (operating system)|Ubuntu]] Community Documentation | date = 2012-03-01}}
* {{cite web | url = https://help.ubuntu.com/community/Installation/SoftwareRAID | title = Installation/SoftwareRAID | work = [[Ubuntu (operating system)|Ubuntu]] Community Documentation | date = 2012-03-01}}
* {{cite web | url = http://www.technotes.se/?p=1732 | title = Setting up a RAID volume in Linux with >2TB disks | author = Lonezor | date = 2011-11-13 | url-status = dead | archiveurl = https://web.archive.org/web/20111119090413/http://www.technotes.se/?p=1732 | archivedate = 2011-11-19 }}
* {{cite web | url = http://www.technotes.se/?p=1732 | title = Setting up a RAID volume in Linux with >2TB disks | author = Lonezor | date = 2011-11-13 | url-status = dead | archiveurl = https://web.archive.org/web/20111119090413/http://www.technotes.se/?p=1732 | archivedate = 2011-11-19 }}

Latest revision as of 08:12, 11 June 2024

mdadm
Original author(s)Neil Brown
Developer(s)Community contributors,
Mariusz Tkaczyk[1]
Initial release2001
Stable release
4.3[2] / February 15, 2024; 6 months ago (2024-02-15)
Repositorygithub.com/md-raid-utilities/mdadm/
Written inC
Operating systemLinux
Available inEnglisch
TypDisk utility
LicenseGNU GPL
Websiteraid.wiki.kernel.org Edit this on Wikidata

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.[3][4][5]

mdadm is free software originally[6] 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

[edit]

The name is derived from the md (multiple device) device nodes it administers or manages, and it replaced a previous utility mdctl.[citation needed] The original name was "Mirror Disk", but was changed as more functions were added.[citation needed] The name is now understood to be short for Multiple Disk and Device Management.[3]

Übersicht

[edit]

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

[edit]
  • 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

[edit]
  • Linear – concatenates a number of devices into a single large MD device – (deprecated since 2021 and removed from the Linux kernel since 2023 [7])
  • 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

Eigenschaften

[edit]

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.[8]

Booting

[edit]

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 oder 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.

With more recent bootloaders it is possible to load the MD support as a kernel module through the initramfs mechanism. This approach allows the /boot filesystem to be inside any RAID system without the need of a complex manual configuration.

External metadata

[edit]

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".[9]

As of October 2013, there are two supported formats of the external metadata:

mdmpd

[edit]

mdmpd was[11] 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.[12] 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.[13]

Technical details RAID 1

[edit]

The data on a RAID 1 volume is the same as on a normal partition. The RAID information is stored in the last 128kB of the partition. This means, to convert a RAID 1 volume to normal data partition, it is possible to decrease the partition size by 128kB and change the partition ID from fd to 83 (for Linux).

See also

[edit]

References

[edit]
  1. ^ "Announcement: mdadm maintainer update". marc.info. 2023-12-14. Retrieved 2024-05-17.
  2. ^ "Release mdadm-4.3". 2024-02-15.
  3. ^ a b Bresnahan, Christine; Blum, Richard (2016). LPIC-2: Linux Professional Institute Certification Study Guide. John Wiley & Sons. pp. 206–221. ISBN 9781119150817.
  4. ^ Vadala, Derek (2003). Managing RAID on Linux. O'Reilly Media, Inc. p. 140. ISBN 9781565927308. mdadm linux.
  5. ^ Nemeth, Evi (2011). UNIX and Linux System Administration Handbook. Pearson Education. pp. 242–245. ISBN 9780131480056.
  6. ^ "Mdadm". Archived from the original on 2013-05-03. Retrieved 2007-08-25.
  7. ^ "md: Remove deprecated CONFIG_MD_LINEAR". GitHub. 2023-12-19. Retrieved 2024-04-30.
  8. ^ "Linux kernel 3.7, Section 5. Block". kernelnewbies.org. 2012-12-10. Retrieved 2014-09-21.
  9. ^ a b "External Metadata". RAID Setup. kernel.org. 2013-10-05. Retrieved 2014-01-01.
  10. ^ "DDF Fake RAID". RAID Setup. kernel.org. 2013-09-12. Retrieved 2014-01-01.
  11. ^ "117498 – md code missing event interface".
  12. ^ "Updated mdadm package includes multi-path device enhancements". RHEA-2003:397-06. Redhat. 2004-01-16.
  13. ^ "Mdadm(8): Manage MD devices aka Software RAID - Linux man page".
[edit]