This software allows for Linux users to efficiently create, manage, and track their Linux systems with ease.
Md arrays have an "autodetect" functionality that can be used to assemble them at boot time. This function is triggered by storing components of an array in partitions of type 'fd', also known as Linux Raid Autodetect. They can also be assembled by simply specifying the component devices in a kernel parameter such as md=0,/dev/sda,/dev/sdb. The listed devices will be used to assemble /dev/md0 (because of the 0). While these mechanisms are useful, they do not always provide complete functionality and are unlikely to be extended.
The preferred way to assemble md arrays at boot time is by using mdadm or mdrassemble. To assemble an array that contains the root filesystem, mdadm needs to be run before the filesystem is mounted. Therefore, it needs to be run from an initial-ram-fs. This review focuses on how this can work.
The recommended approach is to assemble only the array containing the root filesystem from the initramfs. Any other arrays should be assembled using files on the main filesystem to enhance flexibility and maintainability. To create a minimal initramfs for assembling md arrays, you need three files and one directory, which includes: /bin directory, /bin/mdadm statically linked mdadm binary, /bin/busybox statically linked busybox binary, /bin/sh the hard link to /bin/busybox, and /init a shell script that calls mdadm appropriately.
The following is a sample init script:
#!/bin/sh
echo 'Auto-assembling boot md array'
mkdir /proc
mount -t proc proc /proc
if [ -n "$rootuuid" ]
then
arg=--uuid=$rootuuid
elif [ -n "$mdminor" ]
then
arg=--super-minor=$mdminor
else
arg=--super-minor=0
fi
echo "Using $arg"
mdadm -Acpartitions $arg --auto=part /dev/mda
cd /
mount /dev/mda1 /root || mount /dev/mda /root
umount /proc
cd /root
exec chroot . /sbin/init < /dev/console > /dev/console 2>&1
Overall, the mdadm software is an excellent tool for maintaining and monitoring Linux md device arrays seamlessly. It's highly recommended to assemble an array that contains the root filesystem from the initramfs for maximum efficiency.
Version 2.6.9 / 3.0 Devel 3: N/A