troubleshooting Question

Centos 7, grub2, problems putting root on raid1 md array

Avatar of Lelio Michele Lattari
Lelio Michele Lattari asked on
LinuxLinux Distributions
43 Comments1 Solution8484 ViewsLast Modified:
Hi! I have just installed Centos 7 in text mode and I have created md raid1 arrays for /boot /home and / - respectively /dev/md0, /dev/md2 and /dev/md1. I have copied the filesystems to the arrays and the arrays work fine...
The system boots correctly from /dev/md0 (/boot) and the /dev/md3 array for /home also works, but after booting root is still on /dev/sda3 and I cannot find the way to put root on /dev/md1. When I try to boot with root on /dev/md1 the boot process stops and journalctl says that /dev/md1 does not exists - the same happens with UUID reference to the device...

After creating the md arrays I have done the following:

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.old
dracut --mdadmconf --force /boot/initramfs-$(uname -r).img $(uname -r)

and

grub2-mkconfig -o /boot/grub2/grub.cfg


After booting with root on /dev/sda3 we have:

[root@filemon1 ~]# cat /proc/mdstat

Personalities : [raid1]
md1 : active raid1 sdb3[0]
      52395904 blocks super 1.2 [2/1] [U_]

md2 : active raid1 sda5[2] sdb5[0]
      911293248 blocks super 1.2 [2/1] [U_]
      [====>................]  recovery = 21.8% (199387776/911293248) finish=98.7min speed=120184K/sec

md0 : active raid1 sda1[1] sdb1[0]
      511936 blocks [2/2] [UU]

unused devices: <none>

============================================================================
[root@filemon1 ~]# blkid
/dev/sda1: UUID="164b8030-9374-544c-ea0a-9c266e71ac0d" TYPE="linux_raid_member"
/dev/sda2: UUID="5283dd61-f307-4713-aefc-5ae20be3d360" TYPE="swap"
/dev/sda3: UUID="ffd854fb-2873-42e2-a24f-418ce9403c06" TYPE="xfs"
/dev/sda5: UUID="18f7f4c8-f906-02a9-2b37-af7ae9376c77" UUID_SUB="0078a81e-59f6-82d8-d005-af55366d09a0" LABEL="filemon1:2" TYPE="linux_raid_member"
/dev/sdb1: UUID="164b8030-9374-544c-ea0a-9c266e71ac0d" TYPE="linux_raid_member"
/dev/sdb2: UUID="2b1f40b5-ba77-49df-aa5c-9a0a443a1797" TYPE="swap"
/dev/sdb3: UUID="966e1308-ae15-ed8b-1efd-7893b75eee13" UUID_SUB="1e967fb7-ab10-f1bb-353c-78954b74b312" LABEL="filemon1:1" TYPE="linux_raid_member"
/dev/sdb5: UUID="18f7f4c8-f906-02a9-2b37-af7ae9376c77" UUID_SUB="4c7a102a-1180-20f8-4d0f-cf542c91a315" LABEL="filemon1:2" TYPE="linux_raid_member"
/dev/md0: UUID="d3508712-dd77-4481-a2b8-614dc7e1df35" TYPE="xfs"
/dev/md2: UUID="f2f78b42-b663-4a29-8a71-2e3f44e71b46" TYPE="xfs"
/dev/md1: UUID="9c4cbd48-9319-45e4-8492-185551d3a955" TYPE="xfs"

============================================================================
[root@filemon1 ~]# cat /etc/fstab
UUID=9c4cbd48-9319-45e4-8492-185551d3a955 /                       xfs     defaults        1 1
UUID=d3508712-dd77-4481-a2b8-614dc7e1df35 /boot                   xfs     defaults        1 2
UUID=f2f78b42-b663-4a29-8a71-2e3f44e71b46 /home                   xfs     defaults        1 2
UUID=2b1f40b5-ba77-49df-aa5c-9a0a443a1797 swap                    swap    defaults        0 0
UUID=5283dd61-f307-4713-aefc-5ae20be3d360 swap                    swap    defaults        0 0

============================================================================

[root@filemon1 ~]# mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=12220856k,nr_inodes=3055214,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/sda3 on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)        
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=34,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
/dev/md2 on /home type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/md0 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
[root@filemon1 ~]#

==================================================================================================

[root@filemon1 ~]# cat /boot/grub2/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/09_swraid1_setup ###
# 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/09_swraid1_setup ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux, with Linux 3.10.0-123.el7.x86_64' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux
-3.10.0-123.el7.x86_64-advanced-ffd854fb-2873-42e2-a24f-418ce9403c06' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod diskfilter mdraid09
        insmod xfs
        set root='mduuid/164b80309374544cea0a9c266e71ac0d'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/164b80309374544cea0a9c266e71ac0d'  d3508712-dd77-4481-a2b8-614dc7e1df35
        else
          search --no-floppy --fs-uuid --set=root d3508712-dd77-4481-a2b8-614dc7e1df35
        fi
        linux16 /vmlinuz-3.10.0-123.el7.x86_64 root=UUID=ffd854fb-2873-42e2-a24f-418ce9403c06 ro vconsole.keymap=us crashkernel=auto  vconsole.font=latarcyrheb-
sun16 rhgb quiet
        initrd16 /initramfs-3.10.0-123.el7.x86_64.img
}

### 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.0.1406 (Core)  (on /dev/md1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-9c4cbd48
-9319-45e4-8492-185551d3a955' {
        insmod part_msdos
        insmod diskfilter mdraid09
        insmod xfs
        set root='mduuid/164b80309374544cea0a9c266e71ac0d'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/164b80309374544cea0a9c266e71ac0d'  d3508712-dd77-4481-a2b8-614dc7e1df35
        else
          search --no-floppy --fs-uuid --set=root d3508712-dd77-4481-a2b8-614dc7e1df35
        fi
        linux /vmlinuz-3.10.0-123.el7.x86_64 root=/dev/md1
        initrd /initramfs-3.10.0-123.el7.x86_64.img
}
submenu 'Advanced options for CentOS Linux release 7.0.1406 (Core)  (on /dev/md1)' $menuentry_id_option 'osprober-gnulinux-advanced-9c4cbd48-9319-45e4-8492-1855
51d3a955' {
        menuentry 'CentOS Linux release 7.0.1406 (Core)  (on /dev/md1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinu
z-3.10.0-123.el7.x86_64--9c4cbd48-9319-45e4-8492-185551d3a955' {
                insmod part_msdos
                insmod diskfilter mdraid09
                insmod xfs
                set root='mduuid/164b80309374544cea0a9c266e71ac0d'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint='mduuid/164b80309374544cea0a9c266e71ac0d'  d3508712-dd77-4481-a2b8-614dc7e1df35
                else
                  search --no-floppy --fs-uuid --set=root d3508712-dd77-4481-a2b8-614dc7e1df35
                fi
                linux /vmlinuz-3.10.0-123.el7.x86_64 root=/dev/md1
                initrd /initramfs-3.10.0-123.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 ###

I would like to have / filesystem on /dev/md1 after booting.

Thank You for any suggestion!
ASKER CERTIFIED SOLUTION
Lelio Michele LattariIT Manager

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 43 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 43 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros