Software RAID and GRUB2

General support questions
Post Reply
Posts: 56
Joined: 2015/06/21 23:25:20

Software RAID and GRUB2

Post by etpoole60 » 2020/01/16 17:31:15

I've searched but I can't find a procedure or tutorial on how to do the following:
1: How to make sure that boot will work if the drive where anaconda installed the boot loader fails?
2: If it hadn't been done before is there a way to recover when the boot loader drive fails?
From what I see, I've got a unique environment in as much as I've got multiple hard disks (6 drives - 4 - 1TB and 2 - 2TB drives) but no RAID controller so I use software RAID. I created all of my file systems under CentOS 6 about 2.5 years ago and then installed CentOS 7 about 1 year ago. That is the reason why my devices are named /dev/md0 through /dev/md3.
When the holiday vacation approached I powered all of my machines down normally. So when we returned home I started powering things back up this one machine failed to boot, but allowed me to get info maintenance mode (where it sits). This bad machine looks like:
/dev/md0 (raid-1) = /dev/sdc1 + /dev/sdf1 = /boot
/dev/md1 (raid-1) = /dev/sdc2 + /dev/sdf2 = /dev/mapper/vg_opsys (/; /home; /opt; /tmp; /usr; /usr/local; /var)
/dev/md2 (raid-1) = /dev/sdc3 + /dev/sdf3 = /dev/mapper/vg_sysswap) (swap)
/dev/md3 (raid-10) = /dev/sda1 + /dev/sdb1 + /dev/sdc5 + /dev/sdd1) + /dev/sde1 + /dev/sdf5 = /dev/mapper/vg_sysdata (many mount points)
I cannot see any mount points on the raid-10 device (I have not attempted to manually mount anything).
It appears that the boot loader is on /dev/sdf1(?). Can I and How do I install grub2 on /dev/sdc1? Will this solve my problem so I can replace the failed drive and still boot?
I've more information if needed.
Happily Retired
Gene Poole
Woodstock, Georgia

Posts: 23
Joined: 2008/09/18 12:35:09

Re: Software RAID and GRUB2

Post by jabuzzard » 2020/02/04 13:24:50

My approach to software RAID is to boot from a USB stick on the motherboard. I have been using it for many years now without issue.

Sure it creates a single point of failure, but only at boot time, and /boot is only ever read at boot, and written when you do a kernel and/or grub update. That is very infrequently so the chances of wearing out a USB drive is minimal. I have USB drives in servers that been doing /boot duty for a decade and still going strong. I have never had a USB drive used in this capacity fail on my in that time frame. It's minimal use with no moving parts.

As an extra safety check you can have a cron job that rsyncs the contents of /boot onto your RAID array. Then if anything does go wrong with the USB flash drive (something you are most likely to spot during a kernel upgrade when the generation of the new initrd fails, so you can schedule a replacement), you can boot with a rescue CD/USB drive, and rebuild /boot and grub on a new USB drive.

Note, depending on your machine an SD card, compact flash etc. might be more appropriate. I like the Cruzer Fit style drives if you have a type A socket on the motherboard. If not I make my own to a USB drive with 10pin motherboard header with something like a Cruzer Pop drive. However you can get quite cheap 10pin USB headers to type A socket adaptors in eBay if you don't have the soldering skills. USB drives with a 10pin motherboard header are stupidly expensive but are available.

The only thing I would recommend is testing the flash drive with either f3write/read on Linux or h2testw on windows to make sure it is not reporting a fake capacity (personally I do that with all flash drives I purchase).

Post Reply

Return to “CentOS 7 - General Support”