4

I'm struggling with the manual configuration of a RAID1 + RAID10. I'm trying the procedure on a VM (VirtualBox 5.0.14 r105127) on OSX 11.10.3.

The strategy I took is:

The complete set of commands I did is available here.

  • Install first centos on the first disk /dev/sda.
  • Then migrate all the files to the raid arrays cp -a mnt/old* mnt/new (even included the /boot/efi partition)
  • Chrooting into the RAID system
  • Edit /etc/fstab with the corrent mappings
  • Edit /etc/default/grub adding rd.auto=1 rd.lvm=[...] rd.md.uuid=[...] with the correct values.
  • Rebuilding initramfs dracut --mdadmconfig --fstab --add "mdraid" --add-drivers "raid1 raid10"
  • Rebuilding grub.cfg grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
  • Adding the new entries into EFI NVRAM for i in b c d; do efibootmgr --create --disk /dev/sd$i --label "CentOS Backup - /dev/sd$i" --load "\\EFI\\centos\\grub.efi"; done
  • Getting Boot Failed for all the entries.

What Am I missing here?


Details

Few details on the current status, commands issued from the /dev/sda system

lsblk
NAME              MAJ:MIN RM  SIZE RO TYPE   MOUNTPOINT
sda                 8:0    0    8G  0 disk   
├─sda1              8:1    0  200M  0 part   /boot/efi
├─sda2              8:2    0  500M  0 part   /boot
└─sda3              8:3    0  7,3G  0 part   
  ├─centos-root   253:0    0  6,5G  0 lvm    /
  └─centos-swap   253:1    0  820M  0 lvm    [SWAP]
sdb                 8:16   0    8G  0 disk   
├─sdb1              8:17   0  200M  0 part   
├─sdb2              8:18   0  500M  0 part   
│ └─md125           9:125  0  500M  0 raid1  
├─sdb3              8:19   0  3,2G  0 part   
│ └─md126           9:126  0  3,2G  0 raid1  
│   ├─vgroot-swap 253:3    0    1G  0 lvm    
│   └─vgroot-root 253:4    0  2,2G  0 lvm    /mnt/raidsys
└─sdb4              8:20   0  4,1G  0 part   
  └─md127           9:127  0  8,2G  0 raid10 
    └─vghome-home 253:2    0  8,2G  0 lvm    
sdc                 8:32   0    8G  0 disk   
├─sdc1              8:33   0  200M  0 part   
├─sdc2              8:34   0  500M  0 part   
│ └─md125           9:125  0  500M  0 raid1  
├─sdc3              8:35   0  3,2G  0 part   
│ └─md126           9:126  0  3,2G  0 raid1  
│   ├─vgroot-swap 253:3    0    1G  0 lvm    
│   └─vgroot-root 253:4    0  2,2G  0 lvm    /mnt/raidsys
└─sdc4              8:36   0  4,1G  0 part   
  └─md127           9:127  0  8,2G  0 raid10 
    └─vghome-home 253:2    0  8,2G  0 lvm    
sdd                 8:48   0    8G  0 disk   
├─sdd1              8:49   0  200M  0 part   
├─sdd2              8:50   0  500M  0 part   
│ └─md125           9:125  0  500M  0 raid1  
├─sdd3              8:51   0  3,2G  0 part   
│ └─md126           9:126  0  3,2G  0 raid1  
│   ├─vgroot-swap 253:3    0    1G  0 lvm    
│   └─vgroot-root 253:4    0  2,2G  0 lvm    /mnt/raidsys
└─sdd4              8:52   0  4,1G  0 part   
  └─md127           9:127  0  8,2G  0 raid10 
    └─vghome-home 253:2    0  8,2G  0 lvm    
sr0                11:0    1 56,3M  0 rom   

RAID

mdadm --examine --scan --verbose

ARRAY /dev/md/boot  level=raid1 metadata=1.0 num-devices=4 UUID=1f726cc3:387c49c3:3cee8230:f11a4640 name=localhost:boot
   devices=/dev/sdd2,/dev/sdc2,/dev/sdb2
ARRAY /dev/md/root  level=raid1 metadata=1.2 num-devices=4 UUID=fea6baab:29711848:997387aa:295ec48f name=localhost:root
   devices=/dev/sdd3,/dev/sdc3,/dev/sdb3
ARRAY /dev/md/home  level=raid10 metadata=1.2 num-devices=4 UUID=edf6287a:ba1236a6:2a3471d2:edac85cb name=localhost:home
   devices=/dev/sdd4,/dev/sdc4,/dev/sdb4

LVM

vgs
  VG     #PV #LV #SN Attr   VSize VFree 
  centos   1   2   0 wz--n- 7,31g 40,00m
  vghome   1   1   0 wz--n- 8,18g     0 
  vgroot   1   2   0 wz--n- 3,22g     0 
lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao----   6,47g                                                    
  swap centos -wi-ao---- 820,00m                                                    
  home vghome -wi-a-----   8,18g                                                    
  root vgroot -wi-a-----   2,22g                                                    
  swap vgroot -wi-a-----   1,00g 

blkid

/dev/block/8:1: SEC_TYPE="msdos" UUID="1E4D-DBA3" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="b5c88e63-06fa-4f20-8cb9-9bad8b5c79fc" 
/dev/block/253:1: UUID="b9c3c080-76d4-44e2-a0b6-3260193d6345" TYPE="swap" 
/dev/sr0: UUID="2016-01-19-16-46-09-00" LABEL="VBOXADDITIONS_5.0.14_105127" TYPE="iso9660" 
/dev/sdb1: SEC_TYPE="msdos" UUID="CEE8-7E69" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="2a458d61-6959-4ec3-a283-1c4d1f76f69d" 
/dev/sdb2: UUID="1f726cc3-387c-49c3-3cee-8230f11a4640" UUID_SUB="349956d0-e1e9-dcb4-1054-ab700cc64004" LABEL="localhost:boot" TYPE="linux_raid_member" PARTUUID="5cca664e-0cad-44c6-8165-d7a77745f45a" 
/dev/sdb3: UUID="fea6baab-2971-1848-9973-87aa295ec48f" UUID_SUB="07be5c6b-3d27-daad-85ea-a6c6e78fd22a" LABEL="localhost:root" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="ae26fa90-9493-4984-a44e-2892ef11604a" 
/dev/sdb4: UUID="edf6287a-ba12-36a6-2a34-71d2edac85cb" UUID_SUB="d04ed8bb-c427-ad9e-3b0f-3186cf38c17e" LABEL="localhost:home" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="a4ddae48-2c8e-427d-80ec-3c856e80c752" 
/dev/sdc1: SEC_TYPE="msdos" UUID="EE8B-2290" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="bd520660-8448-4bda-9a10-0f03d90468eb" 
/dev/sdc2: UUID="1f726cc3-387c-49c3-3cee-8230f11a4640" UUID_SUB="4ea6709b-1c30-8476-063a-147c8230fa5c" LABEL="localhost:boot" TYPE="linux_raid_member" PARTUUID="1c5f95bb-e4a3-4438-a538-824b6a85176f" 
/dev/sdc3: UUID="fea6baab-2971-1848-9973-87aa295ec48f" UUID_SUB="18d60a38-6306-6f0b-2aad-f5b2fe3dfba1" LABEL="localhost:root" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="1d775697-113c-4bf4-bfec-6f5768b6a0fb" 
/dev/sdc4: UUID="edf6287a-ba12-36a6-2a34-71d2edac85cb" UUID_SUB="7454fefb-3217-16ad-9334-f36db6ab2038" LABEL="localhost:home" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="5f0f489b-60ff-4958-a24c-ad05e9c8e840" 
/dev/sdd1: SEC_TYPE="msdos" UUID="EFF5-FDC4" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="a0670bb3-8dc4-4af9-b5d2-51609caf999a" 
/dev/sdd2: UUID="1f726cc3-387c-49c3-3cee-8230f11a4640" UUID_SUB="9508d1ed-237a-d782-ddaa-87099b90a08d" LABEL="localhost:boot" TYPE="linux_raid_member" PARTUUID="9a4abae3-0ccc-460d-9bd9-814ca391cf69" 
/dev/sdd3: UUID="fea6baab-2971-1848-9973-87aa295ec48f" UUID_SUB="dca1324c-f034-939d-923a-b3255d535781" LABEL="localhost:root" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="21a4d5f4-cbd3-4397-9fab-cf0e1c3e77e4" 
/dev/sdd4: UUID="edf6287a-ba12-36a6-2a34-71d2edac85cb" UUID_SUB="4296c7d1-620e-cfb1-1c37-220022a7f01f" LABEL="localhost:home" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="fbd7b585-bf9e-43fa-8d54-4fcb6749dfc2" 
/dev/md127: UUID="KV9voE-ps3q-BAD5-rKYS-ZZRX-0Edq-WMkR5G" TYPE="LVM2_member" 
/dev/md126: UUID="viiJV2-Uah7-DX82-oiGJ-jBDz-wCOl-TLvDK2" TYPE="LVM2_member" 
/dev/mapper/vghome-home: LABEL="Home" UUID="9e7437a7-1f40-48fd-a544-a70f4be0e52c" TYPE="xfs" 
/dev/mapper/vgroot-swap: LABEL="Swap" UUID="37cc3754-411e-4f4c-9044-e3c76d965968" TYPE="swap" 
/dev/mapper/vgroot-root: LABEL="Root" UUID="82ff7a16-6e1d-4c29-930d-055db267aaa8" TYPE="xfs" 
/dev/md125: LABEL="Boot" UUID="25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1" TYPE="xfs" 

/etc/fstab

mount /dev/vgroot/root /mnt/raidsys
cat /mnt/raidsys/etc/fstab

#
# /etc/fstab
# Created by anaconda on Sat Feb 27 23:23:36 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
#/dev/mapper/centos-root /                       xfs     defaults        0 0
#UUID=1c8085bb-a226-4435-8e6f-0953025f6f1a /boot                   xfs     defaults        0 0
#UUID=1E4D-DBA3          /boot/efi               vfat    umask=0077,shortname=winnt 0 0
#/dev/mapper/centos-swap swap                    swap    defaults        0 0
########################
/dev/mapper/vgroot-root /         xfs   defaults   0 0
UUID=25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1 /boot         xfs   0 0
UUID=CEE8-7E69      /boot/efi      vfat   umask=0077,shortname=winnt 0 0
/dev/mapper/vgroot-swap swap         swap   defaults   0 0

/etc/default/grub

cat /mnt/raidsys/etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.auto=1 rd.lvm.lv=vgroot/root rd.md.uuid=fea6baab:29711848:997387aa:295ec48f rd.md.uuid=1f726cc3:387c49c3:3cee8230:f11a4640 rd.lvm.lv=vgroot/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

Initramfs inspection

mount /dev/md125 /mnt/raidboot
lsinitrd /mnt/raidboot/initramfs-3.10.0-327.el7.x86_64.img | grep raid* | xclip -selection clipboard
Image: /mnt/raidboot/initramfs-3.10.0-327.el7.x86_64.img: 19M
mdraid
-r-xr-xr-x   1 root     root        11264 Feb 28 01:00 usr/lib64/device-mapper/libdevmapper-event-lvm2raid.so
lrwxrwxrwx   1 root     root           44 Feb 28 01:00 usr/lib64/libdevmapper-event-lvm2raid.so -> device-mapper/libdevmapper-event-lvm2raid.so
-rwxr-xr-x   1 root     root          265 Sep 12  2013 usr/lib/dracut/hooks/cleanup/99-mdraid-needshutdown.sh
-rwxr-xr-x   1 root     root          910 Sep 12  2013 usr/lib/dracut/hooks/pre-mount/10-mdraid-waitclean.sh
-rw-r--r--   1 root     root        15037 Nov 19 23:51 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/crypto/async_tx/async_raid6_recov.ko
-rw-r--r--   1 root     root        26061 Nov 19 23:52 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/md/raid0.ko
-rw-r--r--   1 root     root        79765 Nov 19 23:52 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/md/raid10.ko
-rw-r--r--   1 root     root        62645 Nov 19 23:52 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/md/raid1.ko
-rw-r--r--   1 root     root       168581 Nov 19 23:52 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/md/raid456.ko
drwxr-xr-x   2 root     root            0 Feb 28 01:00 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/lib/raid6
-rw-r--r--   1 root     root       101965 Nov 19 23:53 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/lib/raid6/raid6_pq.ko
-rw-r--r--   1 root     root         2138 Nov 20 21:14 usr/lib/udev/rules.d/63-md-raid-arrays.rules
-rwxr-xr-x   1 root     root          708 Sep 12  2013 usr/sbin/mdraid-cleanup
-rwxr-xr-x   1 root     root         1074 Sep 12  2013 usr/sbin/mdraid_start

grub.cfg

mount /dev/sdb1 /mnt/raidboot/efi
ls -al /mnt/raidboot/efi/EFI/centos
totale 5792
drwxr-xr-x. 3 root root    4096 28 feb 01.00 .
drwxr-xr-x. 4 root root    4096 27 feb 23.28 ..
-rwxr-xr-x. 1 root root     128  7 dic 14.19 BOOT.CSV
drwxr-xr-x. 2 root root    4096 28 feb 00.54 fonts
-rwxr-xr-x. 1 root root 1009536 24 nov 16.49 gcdx64.efi
-rwxr-xr-x. 1 root root    7038 28 feb 01.00 grub.cfg
-rwxr-xr-x. 1 root root    1024 27 feb 23.34 grubenv
-rwxr-xr-x. 1 root root 1009536 24 nov 16.49 grubx64.efi
-rwxr-xr-x. 1 root root 1283952  7 dic 14.19 MokManager.efi
-rwxr-xr-x. 1 root root 1291512  7 dic 14.19 shim-centos.efi
-rwxr-xr-x. 1 root root 1296176  7 dic 14.19 shim.efi

cat /mnt/raidboot/efi/EFI/centos/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

terminal_output console
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/00_tuned ###
set tuned_params=""
### END /etc/grub.d/00_tuned ###

### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n ${GRUB2_PASSWORD} ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-82ff7a16-6e1d-4c29-930d-055db267aaa8' {
   load_video
   set gfxpayload=keep
   insmod gzio
   insmod part_gpt
   insmod part_gpt
   insmod part_gpt
   insmod diskfilter
   insmod mdraid1x
   insmod xfs
   set root='mduuid/1f726cc3387c49c33cee8230f11a4640'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint='mduuid/1f726cc3387c49c33cee8230f11a4640'  25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1
   else
     search --no-floppy --fs-uuid --set=root 25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1
   fi
   linuxefi /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/mapper/vgroot-root ro crashkernel=auto rd.auto=1 rd.lvm.lv=vgroot/root rd.md.uuid=fea6baab:29711848:997387aa:295ec48f rd.md.uuid=1f726cc3:387c49c3:3cee8230:f11a4640 rd.lvm.lv=vgroot/swap rhgb quiet 
   initrdefi /initramfs-3.10.0-327.el7.x86_64.img
}
menuentry 'CentOS Linux (0-rescue-26d51bbb9d054b0a8566525e1d8f3937) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-26d51bbb9d054b0a8566525e1d8f3937-advanced-82ff7a16-6e1d-4c29-930d-055db267aaa8' {
   load_video
   insmod gzio
   insmod part_gpt
   insmod part_gpt
   insmod part_gpt
   insmod diskfilter
   insmod mdraid1x
   insmod xfs
   set root='mduuid/1f726cc3387c49c33cee8230f11a4640'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint='mduuid/1f726cc3387c49c33cee8230f11a4640'  25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1
   else
     search --no-floppy --fs-uuid --set=root 25fc17e0-29bb-4e5b-b1b7-06216cd7e0a1
   fi
   linuxefi /vmlinuz-0-rescue-26d51bbb9d054b0a8566525e1d8f3937 root=/dev/mapper/vgroot-root ro crashkernel=auto rd.auto=1 rd.lvm.lv=vgroot/root rd.md.uuid=fea6baab:29711848:997387aa:295ec48f rd.md.uuid=1f726cc3:387c49c3:3cee8230:f11a4640 rd.lvm.lv=vgroot/swap rhgb quiet 
   initrdefi /initramfs-0-rescue-26d51bbb9d054b0a8566525e1d8f3937.img
}
if [ "x$default" = 'CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)' ]; then default='Advanced options for CentOS Linux>CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)'; fi;
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'CentOS Linux release 7.2.1511 (Core)  (on /dev/mapper/centos-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-3e9ce32e-8b26-4053-ad4e-1b75fda46260' {
   insmod part_gpt
   insmod xfs
   set root='hd0,gpt2'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  1c8085bb-a226-4435-8e6f-0953025f6f1a
   else
     search --no-floppy --fs-uuid --set=root 1c8085bb-a226-4435-8e6f-0953025f6f1a
   fi
   linux /vmlinuz-0-rescue-26d51bbb9d054b0a8566525e1d8f3937 root=/dev/dm-5
   initrd /initramfs-0-rescue-26d51bbb9d054b0a8566525e1d8f3937.img
}
submenu 'Advanced options for CentOS Linux release 7.2.1511 (Core)  (on /dev/mapper/centos-root)' $menuentry_id_option 'osprober-gnulinux-advanced-3e9ce32e-8b26-4053-ad4e-1b75fda46260' {
   menuentry 'CentOS Linux release 7.2.1511 (Core)  (on /dev/mapper/centos-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-0-rescue-26d51bbb9d054b0a8566525e1d8f3937--3e9ce32e-8b26-4053-ad4e-1b75fda46260' {
      insmod part_gpt
      insmod xfs
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  1c8085bb-a226-4435-8e6f-0953025f6f1a
      else
        search --no-floppy --fs-uuid --set=root 1c8085bb-a226-4435-8e6f-0953025f6f1a
      fi
      linux /vmlinuz-0-rescue-26d51bbb9d054b0a8566525e1d8f3937 root=/dev/dm-5
      initrd /initramfs-0-rescue-26d51bbb9d054b0a8566525e1d8f3937.img
   }
   menuentry 'CentOS Linux release 7.2.1511 (Core)  (on /dev/mapper/centos-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-3.10.0-327.el7.x86_64--3e9ce32e-8b26-4053-ad4e-1b75fda46260' {
      insmod part_gpt
      insmod xfs
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  1c8085bb-a226-4435-8e6f-0953025f6f1a
      else
        search --no-floppy --fs-uuid --set=root 1c8085bb-a226-4435-8e6f-0953025f6f1a
      fi
      linux /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/dm-5
      initrd /initramfs-3.10.0-327.el7.x86_64.img
   }
}

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

EFI Boot list

efibootmgr -v
BootCurrent: 0001
BootOrder: 0004,0003,0000,0001,0002
Boot0000* EFI DVD/CDROM   ACPI(a0341d0,0)PCI(d,0)SATA(0,0,0)
Boot0001* EFI Hard Drive   ACPI(a0341d0,0)PCI(d,0)SATA(1,0,0)
Boot0002* EFI Internal Shell   MM(b,3fc4f000,3ffbefff)FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
Boot0003* CentOS Linux   HD(1,800,64000,b5c88e63-06fa-4f20-8cb9-9bad8b5c79fc)File(\EFI\centos\shim.efi)
Boot0004* CentOS Raid   HD(1,800,64000,2a458d61-6959-4ec3-a283-1c4d1f76f69d)File(\EFI\centos\shim.efi)
1
  • Question refactored with (hopefully) easier-to-understand informations and possibly shorter.
    – rdbisme
    Commented Feb 28, 2016 at 19:10

1 Answer 1

1

Would it helps if I give you my receipe for a live software-raid install of {Centos,alma,Rock,Oracle}linux8

Step 1) Install Almalinux from the ISO

Install on the disk /dev/sda

Step 2) Upgrade to the latest packages

dnf upgrade
dnf install vim 

(to avoid issue with vi)

Step 3) Install Raid packages

dnf install mdadm

Step 4) Now we need to copy the partition table from sda to sdb

sgdisk -R /dev/sdb /dev/sda
sgdisk -G /dev/sdb

Step 5) Convert the partitions on /dev/sdb to RAID disks

sgdisk -t 1:fd00 -t 2:fd00 -t 3:fd00 /dev/sdb

Step 6) Initialize the RAID

mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1 --metadata=0.90
mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/sdb2 --metadata=0.90
mdadm --create /dev/md2 --level=1 --raid-disks=2 missing /dev/sdb3

Step 7) Copy the /boot on /dev/md0

mkfs.vfat /dev/md0
mkfs.xfs /dev/md1

mkdir /mnt/md1

mount /dev/md1 /mnt/md1
mkdir /mnt/md1/efi

mount /dev/md0 /mnt/md1/efi

rsync -av /boot/. /mnt/md1

Now we need to edit the /etc/fstab file. In the line containing UUID

Ex. UUID=c8ac59b8-ce54-4fca-8107-1b04aaa0194d /boot ext3 defaults 0 1 we replace the UUID part with /dev/md1 OR set the right UUID in place (use blkid)

/dev/md1 /boot      xfs   defaults 0 1
/dev/md0 /boot/efi  vfat  umask=0077,shortname=winnt 0 2

echo raid1 >> /etc/modules-load.d/raid.conf 

cat /etc/modules-load.d/raid.conf 
raid1

dnf reinstal kernel-<current>
dracut -f 

Step 8) Reboot the system

shutdown -r now

after the reboot we can check the result of the command:

mount | grep boot

it must show a line similar to this one:

/dev/md0 on /boot type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)

Now we can tell to GRUB that we want root from /dev/md0

echo 'GRUB_PRELOAD_MODULES="raid dmraid"' >> /etc/default/grub

now edit /etc/default/grub add rd.md.uuid= in GRUB_CMDLINE_LINUX and get UUID of /dev/md2 from "mdadm --detail /dev/md2"

GRUB_CMDLINE_LINUX="resume=/dev/mapper/almalinux-swap rd.lvm.lv=almalinux/root rd.md.uuid=58fd9cb6:0904f51a:1d561e2a:47682614 rd.lvm.lv=almalinux/swap"

cd /etc;grub2-mkconfig -o $(readlink /etc/grub2-efi.cfg)

dnf reinstal kernel-<current>
dracut -f 

Step 9) Add /dev/sdaX to raid /dev/mdY

sgdisk -t 2:fd00 /dev/sda 

mdadm --add /dev/md0 /dev/sda1
mdadm --add /dev/md1 /dev/sda2

Step 10) Move LVM on /dev/md3

installation created a LVM on /dev/sda3 so we need to move it on /dev/md2 and then remove it from /dev/sda3

pvcreate /dev/md2
vgextend almalinux /dev/md2

swapoff -a
lvremove /dev/almalinux/swap

pvmove /dev/sda3 /dev/md2

The pvmove steps will take some time depending on the CPU and the disk size, it took me few hours

vgreduce almalinux /dev/sda3

pvremove /dev/sda3

lvcreate -l +100%VG -n swap almalinux
mkswap /dev/almalinux/swap

Step 11) Add /dev/sda2 to raid

sgdisk -t 3:fd00 /dev/sda

mdadm --add /dev/md2 /dev/sda3

Now, executing the command

cat /proc/mdstat

we can see the RAID is executing the sync of the disks.

when its done then reboot.

1
  • 1
    The only solution I was able to find for the software RAID installation on the system with preinstalled OS (centos in my case). However on the last step 11 I rebooted before sync of the disks was completed. For everyone else who will follow that tutorial make sure to wait for the disks to sync on the latest step cat /proc/mdstat.
    – electroid
    Commented Jul 17, 2023 at 12:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .