Warning: session_start(): open(/var/cpanel/php/sessions/alt-php74/sess_5371fda9af3f892b91f2b6987a4ea36d, O_RDWR) failed: No such file or directory (2) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358

Warning: session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/alt-php74) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358
Create Redundancy RAID 0,1,10 Arrays using Mdadm tools On Ubuntu

Create RAID Arrays with mdadm on Ubuntu

What is mdadm?

The mdadm utility can be used to create and manage storage arrays using Linux’s software RAID capabilities.
Administrators have great flexibility in coordinating their individual storage devices and creating logical storage devices that have greater performance or redundancy characteristics.

Creating a RAID 0 Array

The RAID 0 array works by breaking up data into chunks and striping it across the available disks. This means that each disk contains a portion of the data and that multiple disks will be referenced when retrieving information. This option Require minimum of 2 storage devices

In the following examples we are simulate 4 storage devices

To get started, find full informations for the raw disks that you will be using for the raid:

 
				
					lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT

				
			
Output looks like:
				
					NAME SIZE FSTYPE TYPE MOUNTPOINT
sdc 500G disk
sdd 500G disk
sde 500G disk
sdf 500G disk
vda 20G disk
├─vda1 200G ext4 part /
└─vdb1 100G part

				
			

As above, we have 4 disks without a filesystem, each 500G in size. In this example, these devices have been given the /dev/sdc and /dev/sdd /dev/sde /dev/sdf identifiers for this session. These will be the raw components we will use to build the array.

Create the Array

To create a RAID 0 array ,we need to pass them in to the mdadm –create command. You will have to specify the device name you wish to create (/dev/md0 in our exmaple), the RAID level, and the number of devices:

sudo mdadm –create –verbose /dev/md0 –level=0 –raid-devices=4 /dev/sdc /dev/sdd /dev/sde /dev/sdf

Create and Mount the Filesystem

create a filesystem on the array:
				
					sudo mkfs.ext4 -F /dev/md0
				
			
Create a mount point to attach the new filesystem:
				
					sudo mkdir -p /mnt/md0
				
			
Mount the filesystem
				
					sudo mount /dev/md0 /mnt/md0
				
			

Save the Array Layout

To make sure that the array is reassembled automatically at boot, we will have to adjust the /etc/mdadm/mdadm.conf by executing the following commad:

				
					sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
				
			
update the initramfs, or initial RAM file system, so that the array will be available during the early boot process:
				
					sudo update-initramfs -u
				
			
And Finlay add the new filesystem mount options to the /etc/fstab file for automatic mounting at boot:
				
					echo ‘/dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0’ | sudo tee -a /etc/fstab
				
			

Creating a RAID 1 Array

The RAID 1 array type is implemented by mirroring data across all available disks. Each disk in a RAID 1 array gets a full copy of the data, providing redundancy in the event of a device failure. This option Require minimum of 2 storage devices

In the following examples we are simulate 4 storage devices

To get started, find full informations for the raw disks that you will be using for the raid:

				
					lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
				
			
Output looks like
				
					NAME SIZE FSTYPE TYPE MOUNTPOINT
sdc 500G disk
sdd 500G disk
sde 500G disk
sdf 500G disk
vda 20G disk
├─vda1 200G ext4 part /
└─vdb1 100G part
				
			

As above, we have 4 disks without a filesystem, each 500G in size. In this example, these devices have been given the /dev/sdc and /dev/sdd /dev/sde /dev/sdf identifiers for this session. These will be the raw components we will use to build the array.

Create the Array

To create a RAID 0 array ,we need to pass them in to the mdadm –create shell command. You will have to specify the device name you wish to create (/dev/md0 in our exmaple), the RAID level, and the number of devices:

				
					sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=4 /dev/sdc /dev/sdd /dev/sde /dev/sdf
				
			

Create and Mount the Filesystem

create a filesystem on the array:
				
					sudo mkfs.ext4 -F /dev/md0
				
			
Create a mount point to attach the new filesystem:
				
					sudo mkdir -p /mnt/md0
				
			
Mount the filesystem
				
					sudo mount /dev/md0 /mnt/md0
				
			

Save the Mdadm RAID Arrays Layout

To make sure that the array is reassembled automatically at boot, we will have to adjust the /etc/mdadm/mdadm.conf by executing the following commad:
				
					sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
				
			
update the initramfs, or initial RAM file system, so that the array will be available during the early boot process:
				
					sudo update-initramfs -u
				
			
And Finlay add the new filesystem mount options to the /etc/fstab file for automatic mounting at boot:
				
					echo ‘/dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0’ | sudo tee -a /etc/fstab
				
			

Creating a RAID 10 Array

The RAID 10 array type is traditionally implemented by creating a striped RAID 0 array composed of sets of RAID 1 arrays. This nested array type gives both redundancy and high performance, at the expense of large amounts of disk space. The mdadm utility has its own RAID 10 type that provides the same type of benefits with increased flexibility. It is not created by nesting arrays, but has many of the same characteristics and guarantees. 

We will be using the mdadm RAID 10 here. This option Require minimum of 3 storage devices

In the following examples we are simulate 4 storage devices.

To get started, find full informations for the raw disks that you will be using for the raid:

				
					lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
				
			
Output looks like
				
					NAME SIZE FSTYPE TYPE MOUNTPOINT
sdc 500G disk
sdd 500G disk
sde 500G disk
sdf 500G disk
vda 20G disk
├─vda1 200G ext4 part /
└─vdb1 100G part
				
			
As above, we have 4 disks without a filesystem, each 500G in size. In this example, these devices have been given the /dev/sdc and /dev/sdd /dev/sde /dev/sdf identifiers for this session. These will be the raw components we will use to build the array.

Create Mdadm RAID Arrays

To create a RAID 0 array ,we need to pass them in to the mdadm –create command. You will have to specify the device name you wish to create (/dev/md0 in our exmaple), the RAID level, and the number of devices:

If you want to use a different layout, or change the number of copies, you will have to use the –layout= option, which takes a layout and copy identifier. The layouts are n for near, f for far, and o for offset. The number of copies to store is appended afterwards.

				
					sudo mdadm --create --verbose /dev/md0 --level=10 --layout=o3 --raid-devices=4 /dev/sdc /dev/sdd /dev/sde /dev/sdf
				
			

Create and Mount the Filesystem

create a filesystem on the array:
				
					sudo mkfs.ext4 -F /dev/md0
				
			
Create a mount point to attach the new filesystem:
				
					sudo mkdir -p /mnt/md0
				
			
Mount the filesystem
				
					sudo mount /dev/md0 /mnt/md0
				
			

Save the Array Layout

To make sure that the array is reassembled automatically at boot, we will have to adjust the /etc/mdadm/mdadm.conf by executing the following commad:
				
					sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
				
			
update the initramfs, or initial RAM file system, so that the array will be available during the early boot process:
				
					sudo update-initramfs -u
				
			
And Finlay add the new filesystem mount options to the /etc/fstab file for automatic mounting at boot:
				
					echo ‘/dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0’ | sudo tee -a /etc/fstab
				
			
Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on whatsapp

Related Posts