Introduction
This article lists all the necessary steps for installing a software raid.
Basic information
Software RAID is when the interaction of multiple drives is organized completely by software.
- RAID Level 1 (mirroring) achieves increased security: even if one drive fails, all the data is still stored on the second drive.
- RAID Level 0 (striping) leads to double the capacity (with two drives) and increased reading speed compared to RAID 1. But all data will be lost if even one of the drives fails.
Our installimage, which you can use to manually install an operating system, is also useful for configuring several different RAID levels. Also, you can use it to combine software RAID with LVM.
Servers pre-installed by Hetzner are configured with RAID superblocks (version 1.2) if this is supported by the operating system. (So that applies to all systems with Grub2 as the boot loader). Therefore, if you're doing your installation via VNC, the installers might use other metadata versions.
Email notification when a drive in a software RAID fails
- Requirement: installed and configured mail server
Debian/Ubuntu/CentOS
Edit /etc/mdadm/mdadm.conf or /etc/mdadm.conf (CentOS) and change the following line:
MAILADDR rootHere, you can specify a destination address directly. Or, you can forward all emails sent to root to a specific email address using /etc/aliases.
You can also optionally configure the sending email address:
MAILFROM mdadm@example.comFor Debian and Ubuntu, it is important that you set AUTOCHECK in the file /etc/default/mdadm to true:
# grep AUTOCHECK= /etc/default/mdadm
AUTOCHECK=trueFor CentOS, you must enable the check in the file /etc/sysconfig/raid-check:
# grep ENABLED /etc/sysconfig/raid-check
ENABLED=yesopenSUSE
Edit /etc/sysconfig/mdadm and add the email address that you want the notification sent to next to the variable MDADM_MAIL:
MDADM_MAIL="example@example.com"Removing a software RAID
To remove a software RAID, you can issue the following commands in the Rescue-System:
mdadm --remove /dev/md0
mdadm --remove /dev/md1
mdadm --remove /dev/md2mdadm --stop /dev/md0
mdadm --stop /dev/md1
mdadm --stop /dev/md2After that, you can format the drive normally again (e.g. with ext3):
mkfs.ext3 /dev/sda
mkfs.ext3 /dev/sdbYou can check the result with:
fdisk -lThe software RAID should now be gone.
Then you can use installimage to install a new operating system.
If an OS is installed and software RAID is activated on the server, then just running installimage and installing a new OS without software RAID won't work. The server won't boot in this case.