BootDegradedRaid
Size: 2814
Comment: added bootloader design points
|
Size: 8689
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from BootDegradedRAID (For the howto see bottom of page) |
|
Line 22: | Line 26: |
* Software RAID is often a less expensive alternative to Hardware RAID, and is always available on any Ubuntu system with multiple disk devices * This is particularly useful on low-end and small-form-factor servers without built-in Hardware RAID, such as blades and 1-U rack mount systems * RAID1 (mirroring) is currently a convenient mechanism for providing runtime failover of hard disks in Ubuntu * Remotely administered systems where the owners have taken the initiative to use dedundant disks in a RAID1 configuration expect to be able to boot even after a RAID degradation event |
* Kim uses software RAID since it is less expensive than hardware RAID, and since it is always available on any Ubuntu system with multiple disk devices. She particularly likes it on low-end and small-form-factor servers without built-in Hardware RAID, such as her arrays of blades and 1-U rack mount systems. She uses RAID1 (mirroring) as a convenient mechanism for providing runtime failover of hard disks in Ubuntu. Kim remotely administers her systems, where she has taken great care to use redundant disks in a RAID1 configuration. She absolutely wants to be able to tolerate a RAID degradation event and continue to boot such systems in an unattended manner until she is able to replace the faulty hardware. After rebooting her system following a primary drive failure, the system automatically boots from the secondary drive and brings up the RAID in degraded mode in a fully functional (though unprotected) configuration, since she specified in her system configuration to boot even if the RAID is degraded. * Steph also uses software RAID1 on her /boot and / filesystems. Steph is ''always'' physically present at the console when she reboots systems, and she always has spare disks on hand. Steph ''never'' wants to boot into a system with a degraded MD array. Steph configures her system to trap booting to a degraded array and instead deliver the system to a recovery console, thus more conservatively protecting her data at the expense of yielding her system unbootable in an unattended manner. * HotplugRaid |
Line 36: | Line 38: |
* Switch to use the '''mdadm --incremental''' assembly, supported by mdadm version in 8.04. | |
Line 37: | Line 40: |
* more verbose error hook messages * teach md error handler how to bring up md in degraded mode * {{{ /usr/share/initramfs-tools/scripts/init-premount/mdadm:mountroot_fail() }}} |
|
Line 38: | Line 44: |
* reduce rootfs wait timeout to 30 seconds (DONE) * option to abort rootfs wait, seems non-trivial, but quite handy |
|
Line 41: | Line 49: |
''Will be documented here as implementation occurs'' |
|
Line 42: | Line 52: |
== BoF agenda and discussion == |
|
Line 51: | Line 59: |
* http://osdir.com/ml/linux.redhat.anaconda.devel/2005-05/threads.html | |
Line 53: | Line 62: |
* Compare with HotplugRaid for a common use and test case. == Howto == === Howto boot degraded raids === In ubuntu md devices are set up by udev rules. The mdadm tool shiped with ubuntu supports the --incremental option since 8.04, but it is not used. '''You will need to adjust the following:''' 1. Switch to mdadm --incremental * The mdadm --incremental option does not create device nodes (may rely on the hotplug system to create device notes). Thus additional udev rules are needed to create those devices, or mdadm functionality to create the nodes needs to be reastablished. Furthermore --increment defaults to expect the new device naming scheme for partitionable md devices. (As a workaround you can make your existing devices static by "cp -a /dev/mdX /lib/udev/devices/", and configuring the auto=md scheme in /etc/mdadm/mdadm.conf) * /etc/udev/rules.d/85-mdadm.rules: *The mdadm call needs to be changed to "mdadm --incremantal /dev/%k" *The command "watershed" is not installed by default, at least not in xubuntu 8.04. Is this a build-in of udev? * See: {{{ /usr/lib/udev }}} * I can't find a watershed file there. * Rules for removal events are needed. wiki:Bug:244803 * "mdadm --incremental" will save state in a map file under /var/run/mdadm/map, but during early boot this directory does not yet exist and the state is saved in /var/run/mdadm.map.new (Change man page, it says /var/run/mdadm.map) The early map needs to be moved to the run-time path or something. (Beware of undefined state between mkdir and mv operation for hotplug events?) The --incremental option in the udev rule will only start complete arrays, just as the "--assemble --no-degraded" before, but will more appropriately determine what to do with found array members. It also adds devices to inactive or running arrays and will start the array in auto-readonly mode. This allows raid members that may come up later to join running arrays very smoothly without resyncing if nothing has been written to the array yet. 1. To start arrays that are necessary during boot in degraded mode some extra attention is needed: Do not just run any array that may be partially available (mdadm --assemble --scan --run), but only those that are actually needed at the particular point of time. (i.e. it is not a good idea to start for example the /home array in degraded mode, when we just need the rootfs to boot first. Some slower or external disks of the /home array may become available later.) In the initramfs (wiki:Bug:83025): {{{ If rootfs is on a md device, while timeout not reached, do: if root md device has come up, continue booting wait a second done. if timeout has been reached: mdadm --incremental --run <root md device> (depends on bug #244808 ) }}} Then if additional members get available later they will still be joined by the --incremental udev rule. (A wiki:Bug:244808 workaround for a single internal member partition is: "mdadm --stop /dev/md0" and a subsequent "mdadm --incremental --run /dev/sdaX") Same approach for any other device that needs to be, or is configured to be, started later on even if degraded: Check if md device has come up in the meantime or for a while, and start just those arrays in degraded mode that have been configured for this (all/whitelist/blacklist). Good old /etc/init.d/mdadm-raid could be the place to run the desired arrays in degraded mode like this, and "start-on-boot-even-if-degraded-devices" may possibly get configurable in /etc/default/mdadm. Without this selective approach some partly pluged in array members (removable disks) might get started unintentionally. (It is more concise, when getting the hotplug event "array plugged in" allways means all (active) members are plugged in. wiki:Bug:244810 ) 1. Desktop integration: * Show unstarted lonely array member partitions as icons with right-click "start degraded" option. Rules to stop md arrays when their filesystem is beeing unmounted, so that if members are removed after unmountig the filesystem they won't get set faulty. * A right-click "remove array member" option, to remove a (mirror) member from a running array. * Raid status monitoring frontend GUI to /proc/mdstat etc. |
(For the howto see bottom of page)
Launchpad Entry: https://blueprints.edge.launchpad.net/ubuntu/+spec/boot-degraded-raid
Created: 2008-05-30
Contributors: DustinKirkland
Packages affected: mdadm, grub, initramfs, udev, lvm2
Summary
This specification defines a methodology for enhancing Ubuntu's boot procedures to configure and support booting a system dependent on a degraded RAID1 device.
Rationale
Ubuntu's installer currently supports installation to software RAID1 targets for /boot and /. When one of the mirrored disks fails, and mdadm marks the RAID degraded, it becomes impossible to reboot the system in an unattended manner.
Booting Ubuntu with a failed device in a RAID1 will force the system into a recovery console.
In some cases, this is the desired behavior, as a local system administrator would want to backup critical data, cleanly halt the system, and replace the faulty hardware immediately.
In other cases, this behavior is highly undesired--particularly when the system administrator is remotely located and would prefer a system with redundant disks tolerate a failed device even on reboot.
Use Cases
- Kim uses software RAID since it is less expensive than hardware RAID, and since it is always available on any Ubuntu system with multiple disk devices. She particularly likes it on low-end and small-form-factor servers without built-in Hardware RAID, such as her arrays of blades and 1-U rack mount systems. She uses RAID1 (mirroring) as a convenient mechanism for providing runtime failover of hard disks in Ubuntu. Kim remotely administers her systems, where she has taken great care to use redundant disks in a RAID1 configuration. She absolutely wants to be able to tolerate a RAID degradation event and continue to boot such systems in an unattended manner until she is able to replace the faulty hardware. After rebooting her system following a primary drive failure, the system automatically boots from the secondary drive and brings up the RAID in degraded mode in a fully functional (though unprotected) configuration, since she specified in her system configuration to boot even if the RAID is degraded.
Steph also uses software RAID1 on her /boot and / filesystems. Steph is always physically present at the console when she reboots systems, and she always has spare disks on hand. Steph never wants to boot into a system with a degraded MD array. Steph configures her system to trap booting to a degraded array and instead deliver the system to a recovery console, thus more conservatively protecting her data at the expense of yielding her system unbootable in an unattended manner.
Scope
The scope of this specification is to solve this problem within Ubuntu's software raid support and default bootloader within the Intrepid Ibex development cycle.
Design / Work Items
Bootloader
- grub-install needs to detect (/boot on an md?) or be configured to install grub to multiple devices, thus rendering multiple disks bootable
- should probably also document that manual BIOS changes may be required for disk boot failover to occur properly
Switch to use the mdadm --incremental assembly, supported by mdadm version in 8.04.
MD Error Handling
- more verbose error hook messages
- teach md error handler how to bring up md in degraded mode
/usr/share/initramfs-tools/scripts/init-premount/mdadm:mountroot_fail()
Root Filesystem Wait
- reduce rootfs wait timeout to 30 seconds (DONE)
- option to abort rootfs wait, seems non-trivial, but quite handy
Implementation
Will be documented here as implementation occurs
Outstanding Issues
References
https://blueprints.launchpad.net/ubuntu/+spec/boot-degraded-raid
https://wiki.ubuntu.com/UDS-Intrepid/Report/Server#head-75c995bdf63bb5afe0f08461aba9200b6c95814f
https://lists.ubuntu.com/archives/ubuntu-devel/2007-September/024221.html
http://www.outflux.net/blog/archives/2006/04/23/grub-yaird-mdadm-and-missing-drives/
http://osdir.com/ml/linux.redhat.anaconda.devel/2005-05/threads.html
wiki:120375
wiki:125471
Compare with HotplugRaid for a common use and test case.
Howto
Howto boot degraded raids
In ubuntu md devices are set up by udev rules. The mdadm tool shiped with ubuntu supports the --incremental option since 8.04, but it is not used.
You will need to adjust the following:
- Switch to mdadm --incremental
- The mdadm --incremental option does not create device nodes (may rely on the hotplug system to create device notes). Thus additional udev rules are needed to create those devices, or mdadm functionality to create the nodes needs to be reastablished. Furthermore --increment defaults to expect the new device naming scheme for partitionable md devices. (As a workaround you can make your existing devices static by "cp -a /dev/mdX /lib/udev/devices/", and configuring the auto=md scheme in /etc/mdadm/mdadm.conf)
- /etc/udev/rules.d/85-mdadm.rules:
- The mdadm call needs to be changed to "mdadm --incremantal /dev/%k"
- The command "watershed" is not installed by default, at least not in xubuntu 8.04. Is this a build-in of udev?
See: /usr/lib/udev
- I can't find a watershed file there.
- The command "watershed" is not installed by default, at least not in xubuntu 8.04. Is this a build-in of udev?
Rules for removal events are needed. wiki:244803
- The mdadm call needs to be changed to "mdadm --incremantal /dev/%k"
- "mdadm --incremental" will save state in a map file under /var/run/mdadm/map, but during early boot this directory does not yet exist and the state is saved in /var/run/mdadm.map.new (Change man page, it says /var/run/mdadm.map) The early map needs to be moved to the run-time path or something. (Beware of undefined state between mkdir and mv operation for hotplug events?) The --incremental option in the udev rule will only start complete arrays, just as the "--assemble --no-degraded" before, but will more appropriately determine what to do with found array members. It also adds devices to inactive or running arrays and will start the array in auto-readonly mode. This allows raid members that may come up later to join running arrays very smoothly without resyncing if nothing has been written to the array yet.
- To start arrays that are necessary during boot in degraded mode some extra attention is needed:
- Do not just run any array that may be partially available (mdadm --assemble --scan --run), but only those that are actually needed at the particular point of time. (i.e. it is not a good idea to start for example the /home array in degraded mode, when we just need the rootfs to boot first. Some slower or external disks of the /home array may become available later.)
In the initramfs (wiki:83025):
If rootfs is on a md device, while timeout not reached, do: if root md device has come up, continue booting wait a second done. if timeout has been reached: mdadm --incremental --run <root md device> (depends on bug #244808 )
Then if additional members get available later they will still be joined by the --incremental udev rule.(A wiki:244808 workaround for a single internal member partition is: "mdadm --stop /dev/md0" and a subsequent "mdadm --incremental --run /dev/sdaX") Same approach for any other device that needs to be, or is configured to be, started later on even if degraded:
- Check if md device has come up in the meantime or for a while, and start just those arrays in degraded mode that have been configured for this (all/whitelist/blacklist).
Without this selective approach some partly pluged in array members (removable disks) might get started unintentionally. (It is more concise, when getting the hotplug event "array plugged in" allways means all (active) members are plugged in. wiki:244810 )
- Do not just run any array that may be partially available (mdadm --assemble --scan --run), but only those that are actually needed at the particular point of time. (i.e. it is not a good idea to start for example the /home array in degraded mode, when we just need the rootfs to boot first. Some slower or external disks of the /home array may become available later.)
- Desktop integration:
- Show unstarted lonely array member partitions as icons with right-click "start degraded" option. Rules to stop md arrays when their filesystem is beeing unmounted, so that if members are removed after unmountig the filesystem they won't get set faulty.
- A right-click "remove array member" option, to remove a (mirror) member from a running array.
- Raid status monitoring frontend GUI to /proc/mdstat etc.
BootDegradedRaid (last edited 2010-04-21 10:02:37 by 188-194-18-172-dynip)