What is hardware raid in linux

RAID

Redundant Array of Independent Disks (RAID) is a storage technology that combines multiple disk drive components (typically disk drives or partitions thereof) into a logical unit. Depending on the RAID implementation, this logical unit can be a file system or an additional transparent layer that can hold several partitions. Data is distributed across the drives in one of several ways called #RAID levels, depending on the level of redundancy and performance required. The RAID level chosen can thus prevent data loss in the event of a hard disk failure, increase performance or be a combination of both.

This article explains how to create/manage a software RAID array using mdadm.

RAID levels

Despite redundancy implied by most RAID levels, RAID does not guarantee that data is safe. A RAID will not protect data if there is a fire, the computer is stolen or multiple hard drives fail at once. Furthermore, installing a system with RAID is a complex process that may destroy data.

Standard RAID levels

There are many different levels of RAID; listed below are the most common.

RAID 0 Uses striping to combine disks. Even though it does not provide redundancy, it is still considered RAID. It does, however, provide a big speed benefit. If the speed increase is worth the possibility of data loss (for swap partition for example), choose this RAID level. On a server, RAID 1 and RAID 5 arrays are more appropriate. The size of a RAID 0 array block device is the size of the smallest component partition times the number of component partitions. RAID 1 The most straightforward RAID level: straight mirroring. As with other RAID levels, it only makes sense if the partitions are on different physical disk drives. If one of those drives fails, the block device provided by the RAID array will continue to function as normal. The example will be using RAID 1 for everything except swap and temporary data. Please note that with a software implementation, the RAID 1 level is the only option for the boot partition, because bootloaders reading the boot partition do not understand RAID, but a RAID 1 component partition can be read as a normal partition. The size of a RAID 1 array block device is the size of the smallest component partition. RAID 5 Requires 3 or more physical drives, and provides the redundancy of RAID 1 combined with the speed and size benefits of RAID 0. RAID 5 uses striping, like RAID 0, but also stores parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to reconstruct the data on a replacement disk. RAID 5 can withstand the loss of one member disk.

Note: RAID 5 is a common choice due to its combination of speed and data redundancy. The caveat is that if one drive were to fail and another drive failed before that drive was replaced, all data will be lost. Furthermore, with modern disk sizes and expected unrecoverable read error (URE) rates on consumer disks, the rebuild of a 4TiB array is expected (i.e. higher than 50% chance) to have at least one URE. Because of this, RAID 5 is no longer advised by the storage industry.

Читайте также:  Linux server backup software

RAID 6 Requires 4 or more physical drives, and provides the benefits of RAID 5 but with security against two drive failures. RAID 6 also uses striping, like RAID 5, but stores two distinct parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to reconstruct the data on a replacement disk. RAID 6 can withstand the loss of two member disks. The robustness against unrecoverable read errors is somewhat better, because the array still has parity blocks when rebuilding from a single failed drive. However, given the overhead, RAID 6 is costly and in most settings RAID 10 in far2 layout (see below) provides better speed benefits and robustness, and is therefore preferred.

Nested RAID levels

RAID 1+0 RAID1+0 is a nested RAID that combines two of the standard levels of RAID to gain performance and additional redundancy. It is commonly referred to as RAID10, however, Linux MD RAID10 is slightly different from simple RAID layering, see below. RAID 10 RAID10 under Linux is built on the concepts of RAID1+0, however, it implements this as a single layer, with multiple possible layouts. The near X layout on Y disks repeats each chunk X times on Y/2 stripes, but does not need X to divide Y evenly. The chunks are placed on almost the same location on each disk they are mirrored on, hence the name. It can work with any number of disks, starting at 2. Near 2 on 2 disks is equivalent to RAID1, near 2 on 4 disks to RAID1+0. The far X layout on Y disks is designed to offer striped read performance on a mirrored array. It accomplishes this by dividing each disk in two sections, say front and back, and what is written to disk 1 front is mirrored in disk 2 back, and vice versa. This has the effect of being able to stripe sequential reads, which is where RAID0 and RAID5 get their performance from. The drawback is that sequential writing has a very slight performance penalty because of the distance the disk needs to seek to the other section of the disk to store the mirror. RAID10 in far 2 layout is, however, preferable to layered RAID1+0 and RAID5 whenever read speeds are of concern and availability / redundancy is crucial. However, it is still not a substitute for backups. See the wikipedia page for more information.

Warning: mdadm cannot reshape arrays in far X layouts which means once the array is created, you will not be able to mdadm —grow it. For example, if you have a 4x1TB RAID10 array and you want to switch to 2TB disks, your usable capacity will remain 2TB. For such use cases, stick to near X layouts.

RAID level comparison

RAID level Data redundancy Physical drive utilization Read performance Write performance Min drives
0 No 100% nX

Best; on par with RAID0 but redundant

Источник

What is RAID in Linux, and How to Configure it

W e live in a world of inexpensive data storage. And, that means anyone can use multiple, inexpensive disk drives into arrays to back up their data — hence providing the necessary redundancy they require to keep their data safe. Meet RAID — the process of combining multiple disk drives to create an array of drives. The computer that the RAID is connected to sees it as a single drive or unit and handles it.

In this article, we will look at RAID in Linux and learn how to configure it. However, before we do that, let’s try to under RAID in depth.

What is RAID?

RAID stands for Redundant array of independent disks(RAID). With RAID, the user can use multiple disks for accessing and storing information. RAID is possible using techniques such as disk mirroring(RAID Level 1), disk striping(RAID Level 0), and parity(RAID Level 5). Using these techniques, the RAID setup can achieve benefits such as redundancy, increased bandwidth, lower latency, and recovery of data if the hard disk or storage crashes.

To achieve all the above-mentioned benefits, RAID needs to distribute data to the array drive. The RAID then takes care of the data distribution process by breaking down the data into 32K or 64K sized chunks. The RAID is also capable of dividing the data into bigger chunks and as per the requirement. Once the chunks are created, the data is then written into the hard drive, which is created based on the RAID array.

Similarly, the data is read using the same reversed process, creating the process of data storage and recovery using the RAID array.

Who should use it?

Anyone can actually use RAID arrays. However, system administrators can benefit from it as they need to manage a lot of data. They can also use RAID technology to minimize disk failures, improve storage capacity, or enhance speed.

Types of RAID

Before we proceed further, let’s take a look at the types of RAID. As a system administrator or a Linux user, you can set up and use two types of RAIDs. They are hardware RAID and software RAID.

Hardware RAID: Hardware RAID is implemented independently on the host. This means that you need to invest in hardware to set it up. Of course, they are fast and have their own dedicated RAID controller provided through the PCI express card. This way, the hardware does not use the host resources and performs best thanks to the NVRAM cache that enables faster read and write access.

In case of failure, the hardware stores the cache and rebuilds it using the power backups. Overall, hardware RAID is not for everyone and requires a good amount of investment to get started.

The advantages of Hardware RAID includes the following:

The hardware RAID does have some drawbacks. For instance, there can be vendor lock-in. In that case, if you want to move to a different hardware vendor, you may not get access to your previous RAID system arrangement. Another disadvantage is the associated cost with the setup.

Software RAID: Software RAID depends on the host for resources. This means that they are slow compared to the hardware counterparts, and that’s obvious as they do not get access to their own set of resources compared to hardware RAID.

In the software RAID case, the operating system has to take care of the disk relationship.

The key advantages that you get using software RAID are as below:

There is also one more type of RAID that you should know, i.e., hardware-assisted software RAID. It is a firmware RAID or fake RAID, which you get either at motherboard implementation of inexpensive RAID cards. This approach is ideal for multi-operating system support, whereas the disadvantages include performance overhead, limited RAID support, and specific hardware requirement.

Understanding RAID Levels

    RAID 0: RAID 0 is a disk configuration where you can use two or more devices and then strip data across them. Striping data means breaking them into data chunks. Once broken, they are written on each of the disk arrays. RAID 0 approach is extremely beneficial when it comes to distributing data for redundancy. In theory, the more number of the disk you use, the better the RAID’s performance. However, in reality, it cannot reach that level of performance. In RAID 0, the final disk size is simply the addition of the existing disk drives.

How to configure RAID in Linux

As you can see that there are different RAID configurations that you can configure on your device. So, it is practically not possible to cover all of them in this post. For the sake of simplicity, we are going to do a software RAID 1 implementation. This implementation can be done on the existing Linux distributions.

Before you get started, you need to have some basic stuff ready at your disposal.

1. Getting your hard drive ready

The first step is to make your hard disk ready for the RAID configuration. To know the names of the hard drives that are connected to your computer, you need to open up the terminal and run the following command.

This will list the disk drives or hard drives that are connected to your computer.

For the sake of the tutorial, we are going to use the first disk drive name as /dev/sdb and /dev/sdc

With the hard disk drive names sorted, it is now time to create a new MBR partition table on both the hard drives. Before you do so, it is advisable that you back up any of the data on those hard drives as formating and creating a new MBR partition means losing all your existing partitions and the stored data on the disks.

The code to create new partitions is as below.

sudo parted /dev/sdb mklabel msdos

Similarly, you can partition the 2nd one using the same command. However, you need to change the disk drive name in the command.

In case you want to create GPT based partitions, you can do so by replacing MS-DOS with gpt. However, if you are doing it for the first time and are following the tutorial, we suggest using the MBR partition type.

The next step is to create new partitions on the freshly formatted drives. This is necessary as it will help us to make sure the partitions are auto-detected during the Linux raid autodetect file system.

To get started, type in the following command.

Now, you will have to go through the following steps:

Источник

Оцените статью
Adblock
detector