{"id":9084,"date":"2021-06-15T22:32:35","date_gmt":"2021-06-15T19:32:35","guid":{"rendered":"https:\/\/kifarunix.com\/?p=9084"},"modified":"2024-03-18T21:00:18","modified_gmt":"2024-03-18T18:00:18","slug":"create-raid-level-10-raid-10-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/create-raid-level-10-raid-10-on-ubuntu-20-04\/","title":{"rendered":"Create RAID Level 10 (RAID 1+0) on Ubuntu 20.04"},"content":{"rendered":"\n
Software RAID levels can be managed using In our previous guide, we learnt how to create and setup RAID level 1.<\/p>\n\n\n\n Setup Software RAID on Ubuntu 20.04<\/a><\/p>\n\n\n\n RAID level 10 (1+0), requires at least four drives.<\/p>\n\n\n\n We already have physical drives attached to our system,\/dev\/sd[b-e]<\/strong>, all with 4G<\/strong> storage size.<\/p>\n\n\n\n Partition and initialize the disks attached above as RAID partitions.<\/p>\n\n\n\n Checking the partition tables for the disk;<\/p>\n\n\n\n You can do the same for other disks.<\/p>\n\n\n\n Once the disks are setup, you can now create RAID level 10 (1+0) on Ubuntu 20.04 using the Check if the If not installed, you can install it by running the command below;<\/p>\n\n\n\n The basic command line syntax for [mode]<\/strong> specifies any major mdadm operation mode which can be one of the following;<\/p>\n\n\n\n To create RAID Level 10 (RAID 1+0), such a command can be used.<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n For information on mdadm options, consult man pages.<\/p>\n\n\n\n You can check the status of the created RAID device above using the command below;<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n To list detailed information about each RAID device;<\/p>\n\n\n\n You can also check the status by running the command below;<\/p>\n\n\n\n From the output above;<\/p>\n\n\n\n Once you have created a RAID 10 device, you need to create a filesystem on it to make it useable.<\/p>\n\n\n\n We used four disks each having 4G. Instead of getting 16G in total, RAID 10 cuts the size by half and hence, 8G will be available for use.<\/p>\n\n\n\n The data is mirrored and striped across the disks in the array.<\/p>\n\n\n\n To create a filesystem on RAID 10 device. The command below creates an EXT4 filesystem.<\/p>\n\n\n\n You can now mount your RAID 10 device to start using it<\/p>\n\n\n\n To confirm the mounting;<\/p>\n\n\n\n To automount the device on boot, update Also, you need to update the To write the information to Once you update the When done, updating the initramfs, you can reboot the system to confirm if the RAID device can mount automatically.<\/p>\n\n\n\n And that marks the end of our guide on how to create RAID level 10 (1+0) on Ubuntu 20.04.<\/p>\n\n\n\n Consult Setup Software RAID on Rocky Linux 8<\/a><\/p>\n\n\n\nmdadm<\/strong><\/code> tool on Linux. In this tutorial, you will learn how to create RAID Level 10 (RAID 1+0) on Ubuntu 20.04 using
mdadm<\/strong><\/code> utility. There are different levels of RAID configurations ranging from 0-9. Some levels, such as RAID level 1 (
mirroring<\/code><\/strong>) and RAID level 0 (
striping<\/strong><\/code>) can be combined to provide better storage redundancy and higher chances of data recovery just in case some disks get corrupted.<\/p>\n\n\n\n
Creating RAID Level 10 on Ubuntu 20.04<\/h2>\n\n\n\n
Attach Physical Drives to your Machine<\/h3>\n\n\n\n
lsblk<\/code><\/pre>\n\n\n\n
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\nloop0 7:0 0 93.8M 1 loop \/snap\/core\/8935\nloop1 7:1 0 67M 1 loop \/snap\/lxd\/14133\nsda 8:0 0 15G 0 disk \n\u251c\u2500sda1 8:1 0 1M 0 part \n\u251c\u2500sda2 8:2 0 1G 0 part \/boot\n\u2514\u2500sda3 8:3 0 14G 0 part \n \u2514\u2500ubuntu--vg-ubuntu--lv 253:0 0 14G 0 lvm \/\nsdb 8:16 0 4G 0 disk \nsdc 8:32 0 4G 0 disk \nsdd 8:48 0 4G 0 disk \nsde 8:64 0 4G 0 disk<\/code><\/pre>\n\n\n\n
Creating RAID Partitions<\/h3>\n\n\n\n
for i in {b..e}; do parted -a optimal \/dev\/sd$i mklabel msdos; done<\/code><\/pre>\n\n\n\n
for i in {b..e}; do parted -a optimal \/dev\/sd$i mkpart primary ext4 0% 100%; done<\/code><\/pre>\n\n\n\n
for i in {b..e}; do parted -a optimal \/dev\/sd$i set 1 raid on; done<\/code><\/pre>\n\n\n\n
parted -a optimal \/dev\/sdb print<\/code><\/pre>\n\n\n\n
Model: ATA VBOX HARDDISK (scsi)\nDisk \/dev\/sdb: 4295MB\nSector size (logical\/physical): 512B\/512B\nPartition Table: msdos\nDisk Flags: \n\nNumber Start End Size Type File system Flags\n 1 1049kB 4295MB 4294MB primary raid<\/code><\/pre>\n\n\n\n
Create RAID Level 10 (RAID 1+0)<\/h3>\n\n\n\n
mdadm<\/strong><\/code> command.<\/p>\n\n\n\n
mdadm<\/code><\/strong> package is installed;<\/p>\n\n\n\n
apt list -a mdadm<\/code><\/pre>\n\n\n\n
Listing... Done\nmdadm\/focal-updates,now 4.1-5ubuntu1.2 amd64 [installed,automatic]\nmdadm\/focal 4.1-5ubuntu1 amd64<\/code><\/pre>\n\n\n\n
apt install mdadm<\/code><\/pre>\n\n\n\n
mdadm<\/code><\/strong> commad is;<\/p>\n\n\n\n
mdadm [mode] <raiddevice> [options] <component-devices><\/code><\/pre>\n\n\n\n
\n
Assemble (-A, --assemble)<\/code><\/strong>: assembles the components of a previously created array into an active array.<\/li>\n\n\n\n
Build (-B, --build)<\/code><\/strong>: Builds an array that doesn\u2019t have per-device metadata (superblocks).<\/li>\n\n\n\n
Create (-C, --create)<\/code><\/strong>: Creates a new array with per-device metadata (superblocks).<\/li>\n\n\n\n
Follow\/Monitor (-F, --follow, --monitor)<\/code><\/strong>: Monitor one or more md devices and act on any state changes. This is only meaningful for RAID1, 4, 5, 6, 10 or multipath arrays.<\/li>\n\n\n\n
Grow (-G, --grow)<\/code><\/strong>: Grow (or shrink) an array, or otherwise reshape it in some way.<\/li>\n\n\n\n
Incremental Assembly (-I, --incremental)<\/strong><\/code>: Add a single device to an appropriate array.<\/li>\n\n\n\n
Manage<\/code><\/strong>: This is for doing things to specific components of an array such as adding new spares and removing faulty devices.<\/li>\n\n\n\n
Misc<\/code><\/strong>: This is an \u2018everything else\u2019 mode that supports operations on active arrays, operations on component devices such as erasing old superblocks, and information gathering operations.<\/li>\n\n\n\n
mdadm --create \/dev\/md0 --level=10 --raid-devices=4 \/dev\/sd[bcde]1<\/code><\/pre>\n\n\n\n
mdadm: Defaulting to version 1.2 metadata\nmdadm: array \/dev\/md0 started.<\/code><\/pre>\n\n\n\n
Check the status of the RAID<\/h3>\n\n\n\n
mdadm --detail \/dev\/md0<\/code><\/pre>\n\n\n\n
\/dev\/md0:\n Version : 1.2\n Creation Time : Tue Jun 15 18:35:00 2021\n Raid Level : raid10\n Array Size : 8380416 (7.99 GiB 8.58 GB)\n Used Dev Size : 4190208 (4.00 GiB 4.29 GB)\n Raid Devices : 4\n Total Devices : 4\n Persistence : Superblock is persistent\n\n Update Time : Tue Jun 15 18:35:42 2021\n State : clean \n Active Devices : 4\n Working Devices : 4\n Failed Devices : 0\n Spare Devices : 0\n\n Layout : near=2\n Chunk Size : 512K\n\nConsistency Policy : resync\n\n Name : ubuntu20:0 (local to host ubuntu20)\n UUID : 4491a495:a29490e6:3e353c6d:cffac47d\n Events : 17\n\n Number Major Minor RaidDevice State\n 0 8 17 0 active sync set-A \/dev\/sdb1\n 1 8 33 1 active sync set-B \/dev\/sdc1\n 2 8 49 2 active sync set-A \/dev\/sdd1\n 3 8 65 3 active sync set-B \/dev\/sde1<\/code><\/pre>\n\n\n\n
mdadm --examine \/dev\/sd[bcde]1<\/code><\/pre>\n\n\n\n
cat \/proc\/mdstat<\/code><\/pre>\n\n\n\n
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] \nmd0 : active raid10 sde1[3] sdd1[2] sdc1[1] sdb1[0]\n 8380416 blocks super 1.2 512K chunks 2 near-copies [4\/4] [UUUU]\n \nunused devices: <none><\/code><\/pre>\n\n\n\n
\n
Personalities<\/code><\/strong> line shows the RAID level the kernel currently supports.<\/li>\n\n\n\n
Create a Filesystem on RAID 10 Device<\/h3>\n\n\n\n
mkfs.ext4 \/dev\/md0<\/code><\/pre>\n\n\n\n
Mounting RAID 10 Device<\/h3>\n\n\n\n
mount \/dev\/md0 \/mnt<\/code><\/pre>\n\n\n\n
df -hT -P \/mnt\/<\/code><\/pre>\n\n\n\n
Filesystem Type Size Used Avail Use% Mounted on\n\/dev\/md0 ext4 7.9G 36M 7.4G 1% \/mnt<\/code><\/pre>\n\n\n\n
\/etc\/fstab<\/code><\/strong> file by adding the line similar to the below;<\/p>\n\n\n\n
\/dev\/md0 \/mnt ext4 defaults 0 0<\/code><\/pre>\n\n\n\n
\/etc\/mdadm\/mdadm.conf<\/code><\/strong> by creating a prototype config file that describes currently active arrays that are known to be made from partitions of IDE or SCSI drives using the
mdadm --detail --scan<\/strong><\/code> command<\/p>\n\n\n\n
mdadm --detail --scan<\/code><\/pre>\n\n\n\n
ARRAY \/dev\/md0 metadata=1.2 name=ubuntu20:0 UUID=244a7fd9:d6fcc210:9b559249:df999270<\/code><\/pre>\n\n\n\n
mdadm.conf<\/code><\/strong>, then run;<\/p>\n\n\n\n
mdadm --detail --scan >> \/etc\/mdadm\/mdadm.conf<\/code><\/pre>\n\n\n\n
mdadm.conf<\/strong><\/code>, you can then update initramfs.<\/p>\n\n\n\n
update-initramfs -u<\/code><\/pre>\n\n\n\n
man<\/strong> mdadm<\/strong><\/code> for more information on its usage.<\/p>\n\n\n\n
Other Tutorials<\/h3>\n\n\n\n