TL;DR: Trying to install GRUB2 on block devices that are in RAID1. Stuck at installing bootloader.


to replace HDD-s with smaller SSD-s. Here are the steps that I've taken:

# Booted into rescue mode 
# failed and removed the partition from md array
mdadm --manage /dev/md1 -f /dev/sdb2
mdadm --manage /dev/md1 -r /dev/sdb2

# took out the HDD
# shrunk the filesystem and then the md
resize2fs -f /dev/md1 85G
mdadm --grow /dev/md1 -z 88G

# md1 mounted fine, no issues there. Didn't try to mount /dev/sdd2, as it's Linux RAID type
# recreated partitions on SSD as they are on HDD

# added to array
mdadm --add /dev/md1 /dev/sdb2

# waited for the sync to finish.
# recreated partitions on second SSD
# removed remaining HDD once synced, added SSD to array

gdisk -l

Partition table scan:
  MBR: protective
  GPT: present

Disk label type: GPT
#    Start          End    Size          Type
1     2048         6143      2M      Linux fs
2     6144    195371534   93.2G    Linux RAID


How to install bootloader on the SSD-s? Errors that I'm facing:

grub2-install --directory /mnt/sysimage/boot/grub2/i386-pc /dev/sdd
Installing for i386-pc platform.
grub2-install error: cannot open `/mnt/sysimage/boot/grub2/i386-pc/kernel.img': No such file or directory.


  • CentOS 7
  • mdadm v4.1
  • No LVM

Edit: Added gdisk -l trimmed output

Update #1

After mount --bind-ing /{proc,dev,sys} and running grub2-install, I get following error. Perhaps I've mis-configured something?

grub2-install: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image.. (2x)
grub2-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be psosible.
grub2-install: error: embedding is not possible, but this is rquired for RAID and LVM install.

Update #2

After consulting the manual grub2-install succeeded!

What I did for posterity's sake:

gdisk /dev/sdd
# t - changed partition 1 type to ef02 -- BIOS boot partition
chroot /mnt/sysimage/
grub2-install /dev/sdd
# grub2-install warned about not finding physical volume `(null)' but installation finished without any errors.
# added to md, failed, removed the other disk, repeated grub2-install

Server booted! Thank you for your time and guidance, @telcoM!

Now need to check that everything works :)


The --directory option defines where grub2-install will take the GRUB component files from, while --boot-directory defines where it'll put them to.

It'll be much easier to set up a rescue chroot than to type all the long pathnames required to run grub2-install directly from the rescue environment: you might need to specify --grub-setup, --grub-mkrelpath and --grub-probe in addition to --directory and --boot-directory. So:

mount --rbind /dev /mnt/sysimage/dev
mount -t proc none /mnt/sysimage/proc
mount -t sysfs none /mnt/sysimage/sys
chroot /mnt/sysimage /bin/bash
grub2-install /dev/sdd

But if you want to do it your way: (\ marks a line split for readability)

grub2-install --directory=/mnt/sysimage/usr/lib/grub/i386-pc \
    --grub-setup=/mnt/sysimage/usr/bin/grub2-setup \
    --grub-mkrelpath=/mnt/sysimage/usr/bin/grub2-mkrelpath \
    --grub-probe=/mnt/sysimage/usr/sbin/grub2-probe \
    --boot-directory=/mnt/sysimage/boot \
  • Thanks for quick reply! Tried mounting with bind but unfortunately I'm greeted with warnings and an error (listed in Update #1) Also added fdisk output to the question. It seems I have missed a step or misconfigured something.
    – krg
    Jul 28 '21 at 8:54
  • After ̶R̶T̶F̶M̶ adressing the manual, I managed to install GRUB2 on sdd.
    – krg
    Jul 28 '21 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.