LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-01-2021, 12:59 AM   #1
baddah
Member
 
Registered: Feb 2006
Location: Cape Town,South Africa
Distribution: Fedora Core 8
Posts: 188

Rep: Reputation: 30
GRUB2 question | Replacing drive


Hi,

I have a centos 7 server running software RAID1. One of the drives failed and i'm getting ready to replace it. Already removed the failed drive from array.

Code:
cat /proc/mdstat
Personalities : [raid1] 
md128 : active raid1 sda4[2]
      1771962368 blocks super 1.2 [2/1] [U_]
      bitmap: 5/14 pages [20KB], 65536KB chunk

md125 : active raid1 sda1[2]
      49151872 blocks super 1.2 [2/1] [U_]
      
md126 : active raid1 sda2[3]
      1023936 blocks super 1.0 [2/1] [U_]
      
md127 : active raid1 sda3[2]
      102399872 blocks super 1.2 [2/1] [U_]
      bitmap: 1/1 pages [4KB], 65536KB chunk
Wanted to make sure system will boot from remaining drive so I ran grub2-install /dev/sda but I got the following back.

Code:
grub2-install /dev/sda
Installing for i386-pc platform.
grub2-install: warning: Couldn't find physical volume ‘(null)’. Some modules may be missing from core image..
grub2-install: warning: Couldn't find physical volume ‘(null)’. Some modules may be missing from core image..
My /boot partition is part of the md array. (md126)

I just want to make sure the system will boot when I switch it off to replace the drive. Any pointers on what I can do to be 100% sure it will boot and even suggestions on what to do if it does not.

As a side note - I also have a 3rd drive in this server that is not part of the raid array and just have a normal ext4 filesystem I use to save some extra files. Can i install grub2 to this drive as well?
 
Old 02-04-2021, 08:49 AM   #2
pmv
Member
 
Registered: Apr 2018
Location: Germany
Distribution: OpenSuSE 15.4 Ubuntu 20.04 Archlinux 2022.08.05 Slackware 15.0 OpenSuSE 12.2
Posts: 97
Blog Entries: 5

Rep: Reputation: 31
I know this commands:
Code:
sudo mount /dev/sda6 /mnt
(or if BtrFS: sudo mount -o subvol=@ /dev/sdXY /mnt)
sudo mount -o bind /dev /mnt/dev
sudo mount -o bind /sys /mnt/sys
sudo mount -t proc /proc /mnt/proc
sudo cp /proc/mounts /mnt/etc/mtab
sudo chroot /mnt /bin/bash
Code:
sudo grub-mkconfig --output=/boot/grub/my.cfg (instead of grub.cfg)
 
Old 02-04-2021, 09:30 AM   #3
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,418

Rep: Reputation: 1601Reputation: 1601Reputation: 1601Reputation: 1601Reputation: 1601Reputation: 1601Reputation: 1601Reputation: 1601Reputation: 1601Reputation: 1601Reputation: 1601
Quote:
I also have a 3rd drive in this server that is not part of the raid array and just have a normal ext4 filesystem I use to save some extra files. Can i install grub2 to this drive as well?
Yes, if something goes wrong, you should be able to boot the third drive from the bios boot menu.
Would suggest to make a /boot/grub directory on the drive and then
Code:
grub2-install --boot-directory=<mount point of 3rd drive>/boot /dev/<third drive>
grub2-mkconfig -o /<mount point of 3rd drive>/boot/grub/grub.cfg
 
Old 02-04-2021, 10:50 AM   #4
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,915
Blog Entries: 1

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by pmv View Post
I know this commands:
Code:
sudo mount /dev/sda6 /mnt
(or if BtrFS: sudo mount -o subvol=@ /dev/sdXY /mnt)
sudo mount -o bind /dev /mnt/dev
sudo mount -o bind /sys /mnt/sys
sudo mount -t proc /proc /mnt/proc
I've always used mount -o bind /proc /mnt/proc.
Quote:
Code:
sudo cp /proc/mounts /mnt/etc/mtab
sudo chroot /mnt /bin/bash
At this point also sudo mount -a can be needed before proceeding if using btrfs.
Quote:
Code:
sudo grub-mkconfig --output=/boot/grub/my.cfg (instead of grub.cfg)
 
Old 02-08-2021, 12:23 AM   #5
baddah
Member
 
Registered: Feb 2006
Location: Cape Town,South Africa
Distribution: Fedora Core 8
Posts: 188

Original Poster
Rep: Reputation: 30
So after going through some scenarios in a test environment I have found that those warnings are related to the degraded array and grub will work fine on the remaining drive even with those warnings. So one can safely switch the server off to replace the drive with these warnings.

It looks like the warnings only go away after you have re synced the drive + rebooted it. Not sure why the reboot is needed as well.

Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Revert grub2-efi to grub2-bios Atmchicago Fedora 1 03-24-2014 01:24 AM
[SOLVED] OpenSuSe12.3 - Help Fix Grub2 Syntax Errors (was - Replace Grub2 w/ Lilo) enorbet SUSE / openSUSE 9 12-08-2013 04:09 AM
grub2 can't see my win 7 partition and yast2 bootloader can't reinstall grub2 jjrojaspy SUSE / openSUSE 5 07-07-2013 10:38 PM
kcm-grub2 - No valid GRUB2/BURG installation could be detected cristi92b Linux - Newbie 2 06-14-2012 08:01 AM
[SOLVED] GRUB2 after a minor update of GRUB2 /boot prefix no longer needed?? wikapuki Linux - Software 1 10-24-2010 02:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration