In this first part of the tutorial, I'll show you how to create a RAID 1 on Linux Ubuntu 23.04 on an already installed system!
I found very few resources to perform this kind of operation on an existing system, so I got my hands dirty for you
to offer something operational.
After spending quite some time, I'm happy to present this tutorial. This is the first part dedicated to creating the RAID.
In another part, we'll see how to resynchronize a RAID in case of failure.
Before starting the different manipulations, I explain in detail how RAID works, why it's cool, and how it protects your data.
Then, I guide you through the installation and configuration of RAID 1 on your Linux distribution.
In this video:
00:00 Introduction
04:11 What is RAID?
09:36 Prerequisites
11:39 Creating RAID 1 on Ubuntu
13:29 Adding the 2nd disk on VMware
14:31 Verification and installation
17:49 Verifying MDADM
18:57 Preparing Disk #2
22:58 Creating the RAID
29:16 Updating FSTAB and GRUB
31:32 Copying files to Disk #2
33:58 Reconfiguring GRIB and Initramfs
36:25 Verifying partitions
37:04 Adding Disk #1 to the RAID
40:32 Updating the configuration
42:12 Verifying the RAID
42:52 Conclusion
Here are the commands to use:
=== MDADM installation
sudo apt-get install mdadm
sudo cat /proc/mdstat
=== Cloning the partition table
sudo sfdisk -d /dev/sda | sudo sfdisk /dev/sdb
=== Modifying the partition type
sudo fdisk /dev/sdb
t
3
42
w
=== Creating RAID 1 in degraded mode
sudo mdadm --create /dev/md0 --level=1 --raid-disks=2 --metadata=1.0 missing /dev/sdb2
sudo mdadm --create /dev/md1 --level=1 --raid-disks=2 --metadata=1.0 missing /dev/sdb3
=== MDADM reconfiguration
sudo dpkg-reconfigure mdadm
sudo cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf-dist
sudo mdadm --examine --scan | sudo tee -a /etc/mdadm/mdadm.conf
sudo nano /etc/mdadm/mdadm.conf
DEVICE /dev/sdb2 /dev/sdb3
=== Formatting partitions on Disk #2
sudo mkfs.vfat /dev/md0
sudo mkfs.ext4 /dev/md1
=== Mounting partitions of Disk #2
sudo mkdir /mnt/md0 && sudo mkdir /mnt/md1
sudo mount /dev/md0 /mnt/md0 && sudo mount /dev/md1 /mnt/md1
=== Modifying FSTAB
sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
sudo systemctl daemon-reload
=== Updating GRUB
sudo nano /etc/default/grub
sudo update-grub
sudo dpkg-reconfigure grub-pc
=== Copying data to Disk #2
sudo rsync -auHxv --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* /* /mnt/md1/
sudo rsync -auHxv /boot/efi /mnt/md0
=== Updating GRUB and Initramfs on Disk #2
sudo cp /etc/mdadm/mdadm.conf /mnt/md1/etc/mdadm/mdadm.conf
sudo mount --bind /dev /mnt/md1/dev
sudomount --bind /proc /mnt/md1/proc
sudo mount --bind /sys /mnt/md1/sys
sudo chroot /mnt/md1
update-initramfs -u
update-grub
exit
=== Updating GRUB on Disk #1
sudo cp /boot/grub/grub.cfg /boot/grub/grub.cfg.bak
sudo cp /mnt/md1/boot/grub/grub.cfg /boot/grub/grub.cfg
=== Updating GRUB on Disk #1
sudo fdisk /dev/sda
t
3
42
w
=== Adding Disk #1 to the RAID array
sudo mdadm --manage /dev/md1 --add /dev/sda3
sudo mdadm --manage /dev/md0 --add /dev/sda2
=== Updating MDADM configuration
sudo nano /etc/mdadm/mdadm.conf
DEVICE /dev/sda2 /dev/sda3 /dev/sdb2 /dev/sdb3
=== Updating GRUB and Initramfs on Disk #1
sudo update-initramfs -u
sudo update-grub
...and that's it!
Don't forget to subscribe to the channel to discover the upcoming continuation or simply to discover other cool videos :)
If you have difficulties, questions, or just want to chat with me, feel free to post a comment.
Enjoy watching everyone !
----------------------------------------------------------------------------------------------------------
To follow LaRevueGeek - A site for Geeks ... but not only!
----------------------------------------------------------------------------------------------------------
S I T E W E B : https://www.larevuegeek.com
I N S T A G R A M : / larevuegeek.off
F A C E B O O K : / larevuegeek
T W I T T E R : / larevuegeek
Y O U T U B E : / @larevuegeek
#RAID1 #RAID #ConfigureRAID #RAID0 #RAID5 #RAID10 #Linux #Ubuntu2304 #Installation #Security #Data #Performance #System
#Tools #Tutorial #Guide #Benefits #Management #Monitoring #Troubleshooting #Disks #Mirror #Redundancy #Software #Mdadm
#Partition #Storage #Backup #HardDrive #SSD #Cloning #Synchronization #FileSystem
#Ext4 #XFS #Btrfs #LVM #BIOS #UEFI #GRUB #Boot #Detection #Controller #Partitioning #Formatting #Fstab #MdadmConf
#Failure #Breakdown #Ubuntu2210 #Ubuntu2204 #Debian #Debian11