(7 votes, average: 5.00 out of 5)
Loading..
Software RAID 5 on Linux is the best RAID. It's cheaper than hardware RAID with a proper 400$ controller. It has better speed and compatibility than the motherboard's and a cheap controller's FakeRaid. And it's easy; we just need three HDDs and a few hours. Let's make a software RAID 5 that will keep all of our files safe and fast to access.
Jun 12, 2019 Steps to configure software raid 5 array in Linux using mdadm. RAID 5 is similar to RAID-4, except the parity info is spread across all drives in the array. Skip to content.
Unblock any international website, browse anonymously, and download movies and Mp3 with complete safety with CyberGhost, just for $2.75 per month:
We prepared this guide on Ubuntu 16.04 LTS and Linux Mint 18.1. It should also work with recent earlier and later versions, and on most distributions based on Debian/Ubuntu.
- Software RAID 0 Configuration in linux RAID is one of the heavily used technology for data performance and redundancy. Based on the requirement and functionality they are classified into different levels. Selecting a level for your requirement is always dependent on the kind of operation that you want to perform on the disk.
- Mar 04, 2008 Contains comprehensive benchmarking of Linux (Ubuntu 7.10 Server) software RAID as well as FreeBSD software RAID (and some nVidia 'fake raid' as well.
If something doesn't work for you, leave us a comment.
Table of Contents
- How to create a Software RAID 5 on Linux
Will a Linux software RAID 5 work in Windows?
To create a Software RAID in Linux, we use mdadm, which is an application unique to Linux. It's impossible for Windows to recognize or access a mdadm RAID.
For software RAID 5 or Software RAID 1 on Windows, check out our guides:
How to Install mdadm
mdadm (Multiple Device ADMinistrator) is the prevalent solution for creating a software RAID on Linux. It's a straightforward and powerful application. We can use it not only for software RAID 5 but pretty much for any level of RAID, simple or nested.
Before we create our first array, it's always a good idea to do a full update. We just need to open a terminal with ctrl+alt+T and type:
The system will ask us for the administrator password. While we type the password, nothing will appear in the terminal, no asterisks, dots or anything. This is the default behavior for the linux terminal, so just type away and press Enter.
After the update, if it installed any new packages, it's a good idea to reboot the system. Since we already have a terminal open, the quickest way to reboot is by typing:
Once we log back in, we open a new terminal and type:
At the end of the installation, we will get a couple of warnings by default. It's nothing to worry about.
How to install GParted
The Gnome Partition Editor, or GParted, is the best GUI partitioning tool in Linux. To install it, we type at the terminal:
We can start GParted with:
How to create a Software RAID 5 on Linux
Software RAID 5 with mdadm is flexible. We can use full disks, or we can use same sized partitions on different sized drives. We just need to remember that the smallest of the HDDs or partitions dictates the array's capacity.
The array's capacity in RAID 5
For RAID 5, the formula for the total capacity is:
Linux Software Raid 0 Performance
If we have three 1TB disks, the total array size will be:
If we have three 1TB drives and one 500GB disk, the total array capacity will be:
Preparing the disks
First off, we start GParted and make sure all the disks for the software RAID 5 are visible to the system.
In the example we will create a 2TB software RAID 5 with three 1TB disks, /dev sdb, /dev/sdc, /dev/sdd.
We will use the full disks, but we could also create three equal partitions and select them for the RAID.
If the drives we use are brand new and have an exclamation mark next to the 'unallocated' label, we need to create a partition table on each, through the Device menu.
For disks less than 2TB we select msdos.
Disks more than 2TB require a gpt partition table.
After we created the partition table, and with the exclamation mark gone, we right-click and create a new partition on each of the three disks.
The file system we choose doesn't matter, since creating the software RAID 5 will completely wipe-out the selected partitions' content.
Finally, we apply the changes for all three disks.
We also make sure to remember the partitions' names. On disk /dev/sdb the first partition will be /dev/sdb1, on the /dev/sdc it will be /dev/sdc1 etc.
Caution: Don't mount those new disks/partitions. We need them unmounted to create the software RAID 5.
Make sure you have enough time
The array building procedure will take hours. It's automated, so we don't need to sit in front of the PC. But we can't shut down the computer or restart it either. And we can't pause or stop the procedure. Claymore episode 1 english dub.
It took mdadm about seven hours to create a 2TB software RAID 5 with three 1TB disks. A bigger array could take more than twenty hours to build.
And, we cannot stress that enough, there is no way to pause or stop the array building. If this happens by force - e.g. we shut down the computer, or the power goes out - then we are in trouble.
Recovering the array is more complicated that creating it in the first place. Also, it won't resume from where it was; it will restart from the beginning. Minecraft city world download pc.
Creating the software RAID 5
A single command is enough to create the array. Ignore that it wraps because of the page width, it's a single-line command.
In this command:
- md0 is the name we selected for the array, always in /dev/
- --chunk=64 is the stripe size. 64KB is a good value for most uses.
- --level=5 is the RAID level
- --raid-devices=3 is the number of disks or partitions
- /dev/sdb1, /dev/sdc1, /dev/sdd1 are the names of the partitions. If we are using full disks, we treat each of them as a single partition.
Mdadm will show us the size of the selected partitions and ask is if we want to continue creating the array. We type 'y' for 'yes.'
The building of our software RAID 5 has begun.
And now we wait
Even though the software RAID 5 building is under way, mdadm won't show its progress. To watch the procedure, we type:
This will show the RAID building and will refresh every 2 seconds.
As we mentioned, for an average array, this could take all night. We wrote this guide on a Virtual Machine with virtual hard drives, and the estimation for the software RAID 5 creation was at about 84 minutes.
However, on a real-world software RAID 5 we created back in 2015, the initial estimation was nearly four and a half hours.
More than five hours later, on 8:49, the array still wasn't done, with another 20% to go.
The procedure ended at around 10:15, about 7 hours after it started for a 2TB software RAID 5.
Format and mount the array
Once the array is ready, we need to format it with the file system of our choice. We can't format it though GParted, so we need to do it with a command:
We will find the new array among our devices.
Now, we must create a folder to mount it on each startup automatically. A good choice is the /media/ folder, where the external storage gets mounted.
We mount the array with:
Finally, we take full ownership of the RAID, to get write access.
Now we can create files and folders as we wish. We can also delete the lost+found folder.
Auto-mount the software RAID 5 on startup
For the final step, we will set up the software RAID 5 to auto-mount at boot time.
First, we need to find the UUID of our array. We do that with the command:
This will show a multi-character text, which is unique for our RAID. We select it, right-click and copy it.
Then we open the /etc/fstab file as root with a text editor, e.g. gedit on Ubuntu or xed on Linux Mint.
At the end of the file we add:
We save the file, and that's it.
Now, on each boot, the RAID will already be mounted for us at the /media/Raid folder.
Did you have any trouble creating a software RAID 5 in Linux?
If anything on the guide didn't work as described, and you weren't able to create a software RAID 5 on your Linux distribution, leave us a comment.
Support PCsteps
Do you want to support PCsteps, so we can post high quality articles throughout the week?
You can like our Facebook page, share this post with your friends, and select our affiliate links for your purchases on Amazon.com or Newegg.
If you prefer your purchases from China, we are affiliated with the largest international e-shops:
In this article I will share the steps to configure software raid 5 using three disks but you can use the same method to create software raid 5 array for more than 3 disks based on your requirement. I will explain this in more detail in the upcoming chapters. I have written another article with comparison and difference between various RAID types using figures including pros and cons of individual RAID types so that you can make an informed decision before choosing a RAID type for your system
RAID 5: Distributed Parity
RAID 5 is similar to RAID-4, except that the parity information is spread across all drives in the array. This helps reduce the bottleneck inherent in writing parity information to a single drive during each write operation.
How does RAID 5 works?
RAID-5 eliminates the use of a dedicated parity drive and stripes parity information across each disk in the array, using the same XOR algorithm found in RAID-4. During each write operation, one chunk worth of data in each stripe is used to store parity. The disk that stores parity alternates with each stripe, until each disk has one chunk worth of parity information. The process then repeats, beginning with the first disk.
Take the example of a RAID-5 with five member disks. In this case, every fifth chunk-sized block on each member disk will contain parity information for the other four disks. This means that, as in RAID-1 and RAID-4, a portion of your total storage space will be unusable. In an array with five disks, a single disk’s worth of space is occupied by parity information, although the parity information is spread across every disk in the array. In general, if you have N disk drives in a RAID-5, each of size S, you will be left with
IMPORTANT NOTE:(N-1) * S
space available. So, RAID-4 and RAID-5 yield the same usable storage.Also like RAID-4, a RAID-5 can withstand only a single disk failure. If more than one drive fails, all data on the array is lost.
Why choose RAID 5 over RAID 4?
RAID-5 has become extremely popular among Internet and e-commerce companies because it allows administrators to achieve a safe level of fault-tolerance without sacrificing the tremendous amount of disk space necessary in a RAID-1 configuration or suffering the bottleneck inherent in RAID-4. RAID-5 is especially useful in production environments where data is replicated across multiple servers, shifting the internal need for disk redundancy partially away from a single machine.
ALSO READ:Step-by-Step Tutorial: Configure software Linear RAID 0 in Linux
Step-by-Step Tutorial: Configure Software RAID 0 in Linux
Step-by-Step Tutorial: Configure Software RAID 1 in Linux
Step-by-Step Tutorial: Configure Software RAID 4 in Linux
Step-by-Step Tutorial: Configure Hybrid Software RAID 10 in Linux
Step-by-Step Tutorial: Configure Software RAID 0 in Linux
Step-by-Step Tutorial: Configure Software RAID 1 in Linux
Step-by-Step Tutorial: Configure Software RAID 4 in Linux
Step-by-Step Tutorial: Configure Hybrid Software RAID 10 in Linux
Configure Software RAID 5
There are below certain steps which you must follow before creating software raid 5 on your Linux node. Since I have already performed those steps in my older article, I will share the hyperlinks here:
Important Rules of Partitioning
Partitioning with fdisk
Create Software RAID 5 Array
HINT:Software RAID 5 offers much better performance when compared with Software RAID 4; almost everyone should choose the former.
Now since we have all the partitions with us, we will create software RAID 4 array on those partitions
Execute the below command to create software raid 5 array using
/dev/sdb1
, /dev/sdc1
and /dev/sdd1
mdadm
defaults to the left-symmetric algorithm, so you can safely omit the -p
option from the command line.![Linux Software Raid Performance Linux Software Raid Performance](/uploads/1/2/5/0/125010281/840976729.jpg)
The left-symmetric algorithm will yield the best disk performance for a RAID-5, although this value can be changed to one of the other algorithms (right-symmetric, left-asymmetric, or right-asymmetric).
Here,
Verify the Changes
RAID-5 provides a cost-effective balance of performance and redundancy. You can add more disks, using device/raid-disk, or spare disks, using device/spare-disk, to create large, fault-tolerant storage.
Create filesystem and mount point
Once all three arrays are activated, simply build a filesystem on the stripe
/dev/md0
, in this case and then mount /dev/md0
on a mount point. I have already written an article to create a filesystem and mount point to access the filesystem, you can follow the same article and create your required filesystem on /dev/md0
to access the software raid 5 array.Create Software RAID 5 with more disks
To create a software raid 5 array using 5 disk partitions, you can use below command
During a disk failure, RAID-5 read performance slows down because each time data from the failed drive is needed, the parity algorithm must reconstruct the lost data. Writes during a disk failure do not take a performance hit and will actually be slightly faster. Once a failed disk is replaced, data reconstruction begins either automatically or after a system administrator intervenes, depending on the hardware.
Once the sync is complete re-validate the output of
mdstat
Lastly I hope the steps from the article to configure software raid 5 array on Linux was helpful. So, let me know your suggestions and feedback using the comment section.
References:
Managing RAID in Linux