Hi, this is my first post on ictDude and i’m going to show you how to install CentOS 7 in a software RAID Level 1 (mirror) configuration with LVM. If You dont have two disks on stock or don’t want to screw things up i will start with a virtual machine intro. I’ll setup a two fixed size virtual drives and move on with a fresh RAID Level 1 LVM CentOS 7 install.
If You find this post helpful, leave a comment and like me on facebook.
Requirements for this tutorial ( hardware setup ):
- Two Hard Disks
- CentOS CD/DVD/Bootable USB installation media
OR ( virtual machine setup )
- VirtualBox installer
- CentOS 7 iso file
Virtual Machine Setup Intro:
Download CentOS 7 netinstall iso from HERE
( i have chosen netinstall for this tutorial but feel free to pick any of the available iso that suits your needs)
Download and install VirtualBox from HERE
Start Oracle VM VirtualBox and click New to start a VM wizard.
Enter the Name of Your Virtual Machine. Select Linux from the Type dropdown. Set RedHat (64 bit) as a Version – you won’t find CentOS on this list but RedHat is basically a commercial version of CentOS. Click Next.
Choose RAM size for your virtual machine. As this is just a install testbed i will leave 512MB. Click Next
Choose Create a virtual hard drive now (this will create 1 of 2 virtual drives required for RAID1 setup) Click Create
Choose VDI as a type of file and click Next. Choose a Fixed size in an storage step and click Next. As this is a first drive i suggest setting proper name for it: in my case ictDude_01_a. Select the size of the disk: I’ll leave 8GB ( this is 8GB per drive so 16GB on your host hard disk in total ). Click Create.
Now VM is created but we need to repeat previous steps for the second disk:
On the left you’ll see a list of virtual machines. Newly created VM has a “Powered Off” status. Right click on it’s name and from context menu select Settings. From the list on the left choose storage. On the right you have one disk (in my case ictDude_01_a) in SATA controller section. Right Click on SATA controller and Add Hard Disk and then Create new disk.
Now we’re going to repeat above steps for second disk:
Choose VDI as a type of file and click Next. Choose Fixed size in an storage step and click Next. Set a name for a second drive: in my case ictDude_01_b. Select the size of the disk: I’ll leave 8GB ( this is 8GB per drive so 16GB in total ). Click Create.
We have two virtual hard drives. Before we power up our VM, we need to mount an iso file with CentOS 7 on a virtual CD/DVD drive. Click on Empty device on Controller: IDE, and in attributes section click CD icon, then Choose a virtual CD/DVD disk. Navigate and open CentOS 7 iso file. Empty turned into Centos-7.. label. Click OK.
We are good to go with an OS installation.
Important Note for beginners: Use right Ctrl key to switch between Host(Your system) and Guest(virtual Machine)
Click Your VM from the list on left and Start with an green arrow button.
CentOs 7 Installation with RAID1 and LVM
Once You Boot Up with a CentOS 7 Installation media choose Install CentOS.
On a welcome screen choose installer language and click Continue.
Now you’re on installation summary. Let’s take a look at each installation item marked with warning icon.
Network & Hostname
In upper right corner switch device ON.
In the lower left corner enter hostname.
After that click Done in the upper left corner.
Date & Time
Choose your region, city, time format, time and date.
You can choose Your city directly by clicking on the map.
If You have internet connection, you can switch on Network Time, to synchronize date & time with NTP server.
After that click “Done” in the upper left corner.
Since i have chosen netinstall iso, i will specify here a mirror for OS download. Pick a mirror from your country or nearby countries:
change URL to have os instead of isos
Ex. centos.hitme.net.pl/7/isos/x86_64/ to centos.hitme.net.pl/7/os/x86_64/
Choose the base environment that suits you. Ex. minimal.
Now we have to prepare RAID for system installation.
Check both disks from “Local Standard Disks” area.
Ensure both disks are checked.
Select I will configure partitioning.
Click Full disk summary and bootloader…
Ensure first disk is checked.
Since we have mirror RAID, you can check only one, but both disks will have a bootloader.
Add a new mount point (“+” icon) set mount point /boot and capacity to 512 .
Change Device Type to RAID, and RAID Level to RAID1.
Now we have one RAID device, for /boot
We need another for Logical Volume Group.
From this point you have two options.
You can set whole capacity to ‘/’ mount point, or set capacity per nodes like /home, /var or whatever.
I’ll follow the second option.
/ 1GB /home 1GB /usr 1GB /usr/local 2GB /tmp 512MB swap 1GB /var leave empty to fill disk capacity
Add a new mount point ‘/’ set size to whatever you want.
On right area set Device Type to LVM, and at Volume Group ‘centos’ click Modify…
Make sure that other mount points under ‘/’ (excluding /boot) have type set to LVM, and are in the same volume group with RAID Level 1.
Click Done (twice if neccessary) and then Accept Changes.
Ensure that there is no warning sign at any of items on instalation summary screen.
Click Begin Installation.
During installation set up root password and create non-root user.
Once installation is complete, click Reboot button.
Boot into your new system, and log in as a root.
Check RAID Array status with
[root@localhost ~]#cat /proc/mdstat Personalities : [raid1] md126 : active raid1 sda2 sdb2 7859136 blocks super 1.2 [2/2] [UU] bitmap: 0/1 pages [OKB], 65536KB chunk md127 : active raid1 sdb1 sda1 524224 blocks super 1.0 [2/2] [UU]
You should now see two md devices with RAID Level 1 .