Issue
Basically, I try to migrate a single disk linux system(Centos7) to raid1, refer to this link page: LVM Single Drive to LVM RAID 1 Mirror Migration
But it's failed when I reboot the second, the system enter dracut mode
and I got some message by journalctl
:
dracut-initqueue[305]: Warnging: dracut-initqueue timeout - starting timeout scripts
dracut-initqueue[305]: Warnging: Could not boot.
dracut-initqueue[305]: Warnging: /dev/mapper/rootvg-root does not exist
dracut-initqueue[305]: Warnging: /dev/rootvg/root does not exist
dracut-initqueue[305]: Warnging: /dev/rootvg/swap does not exist
All steps can summarized into two point, migrate /dev/sda1(/boot)
to /dev/md0
and migrate /dev/sda2(lvm)
to /dev/md1
, here is my partitions before migrate /dev/sda2
:
[root@~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 500M 0 part
│ └─md0 9:0 0 499.7M 0 raid1 /boot
└─sda2 8:2 0 49.5G 0 part
├─rootvg-root 253:0 0 29.3G 0 lvm /
├─rootvg-swap 253:1 0 3.9G 0 lvm [SWAP]
└─rootvg-docker 253:2 0 9.8G 0 lvm /var/lib/docker
sdb 8:16 0 50G 0 disk
├─sdb1 8:17 0 500M 0 part
│ └─md0 9:0 0 499.7M 0 raid1 /boot
└─sdb2 8:18 0 49.5G 0 part
└─md1 9:1 0 49.5G 0 raid1
Exactly, the issue is happened after move lvm partitions to raid1, I make sure the system can boot after add /dev/sda1
to the first raid1 array /dev/md0
.
So when I use pvmove
, vgreduce
and pvremove
migrate /dev/sda2
to /dev/md1
, the system can not boot (nomatter add /dev/sda2
to /dev/md1
or not)
I searched a lot and promise I'm not forget execute dracut
(instead of mkinitrd
) to generate initramfs
, but I'm also concerned about if the arguments is incorrect, here is:
dracut --mdadmconf --lvmconf --fstab --add-drivers "raid1" --filesystems "ext4 xfs" --force /boot/initramfs-$(uname -r).img $(uname -r)
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda
grub2-install /dev/sdb
Thanks in advance:)
Solution
Finally I found the answer: We have to change /etc/default/grub
and add rd.md.uuid
before we exec grub2-mkconfig
to update our grub configuration file. that will help us make raid array at grub step when system boot, then also your system can rightly identify the lvm, everything is ok.
I test it on Centos7, it works.
Answered By - Mer