please~~~can someone tell me how to setup software raid1 when install centos 7

General support questions
Post Reply
jiangzh
Posts: 3
Joined: 2020/09/16 11:00:38

please~~~can someone tell me how to setup software raid1 when install centos 7

Post by jiangzh » 2020/09/16 11:09:35

I was trying to install centos 7 and setup software raid when chosen install dest. after I install it, and mdstat showing resync is finished, I still cant boot up with only one disk connected, it will come up to emergency mode no matter which disk connected, only two disks are connected then I can get into system.

I really dont understand why it is so difficult and complicated to setup software raid when installing centos 7.

really appreciate if someone could help me about this!

aks
Posts: 3019
Joined: 2014/09/20 11:22:14

Re: please~~~can someone tell me how to setup software raid1 when install centos 7

Post by aks » 2020/09/16 17:24:10

I still cant boot up with only one disk connected, it will come up to emergency mode no matter which disk connected, only two disks are connected then I can get into system.


That's strange, sure the boot bits are not linked somehow across both disks? Or perhaps something in your BIOS?

Here's the relevant bits I did for a a kickstart on C7 ages back (where I could boot off either or both disks):
ignoredisk --only-use=sda,sdb
clearpart --drives=sda,sdb --all --initlabel
bootloader --location=mbr --driveorder=sda,sdb
bootloader --append="crashkernel=auto" --location=mbr --boot-drive=sda
part raid.820 --fstype="mdmember" --ondisk=sdb --size=4104
part raid.505 --fstype="mdmember" --ondisk=sdb --size=251
part raid.1685 --fstype="mdmember" --ondisk=sda --size=472584
part raid.1691 --fstype="mdmember" --ondisk=sdb --size=472584
part raid.814 --fstype="mdmember" --ondisk=sda --size=4104
part raid.499 --fstype="mdmember" --ondisk=sda --size=251
raid swap --device=swap --fstype="swap" --level=RAID0 raid.814 raid.820
raid /boot/efi --device=boot_efi --fstype="efi" --level=RAID1 --fsoptions="umask=0077,shortname=winnt" raid.499 raid.505
raid / --device=root --fstype="ext4" --level=RAID1 --label=rootFS raid.1685 raid.1691
bootloader --iscrypted --timeout=2 --password=grub.xxxxxxxxxxxxxxxxxxxxxxxx

The point is to have the boot bits on both disks.

Worked for me.

jiangzh
Posts: 3
Joined: 2020/09/16 11:00:38

Re: please~~~can someone tell me how to setup software raid1 when install centos 7

Post by jiangzh » 2020/09/17 13:14:53

Thanks aks

I think centos have to do something with the raid config in the install program, you have to do a lot of things that make something work which should be easily done, for example, the partitioning in ubuntu is much much much easier to do, and the raid1 I setup in the installing progress dont need me to do anything after config finished.

I dont know much about the bootloader, should I leave boot partition in default mode? I guess I have to setup home and other partition in lvm and raid1 right? and then how to write this boot loader?

User avatar
KernelOops
Posts: 319
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: please~~~can someone tell me how to setup software raid1 when install centos 7

Post by KernelOops » 2020/09/17 17:49:37

I frequently do this for desktop systems, I use software RAID 1 across two or more drives.

What they don't tell you in all those raid tutorials, is that you need to install GRUB separately on each drive. Otherwise you won't be able to boot at all...

Even then, you still won't boot, because in addition to GRUB you also need the /boot partition (and /boot/efi if you use UEFI/secureboot) to be RAID mirrored across all drives.

Once GRUB and /boot (/boot/efi) are all properly synced across drives, THEN you are safe and you may boot from any drive you like.

For example:

/dev/sda1 = /boot
/dev/sda2 = /

/dev/sdb1 = /boot
/dev/sdb2 = /

/dev/md0 = RAID 1 with sda1 + sdb1
/dev/md1 = RAID 1 with sda2 + sdb2

install grub on both drives and you are done, you should be able to boot from both drives.
--
I love my computer - all my friends live there.
--

Post Reply

Return to “CentOS 7 - General Support”