Before getting started please read my previous post for RHEL/CentOS 6.x systems here. grub2 is vastly different than grub and I did not find any good solution of doing this on a live machine so lets get started. The setup will be the same as the previous post.
make sure that the 2nd disk is added and now clone the partitions. You can also create partitions manually if you like or if you want to change the sizes of the partitions.
[root@cent7 ~]# cat /proc/partitions
major minor #blocks name
8 0 8388608 sda
8 1 1048576 sda1
8 2 7339008 sda2
8 16 8388608 sdb
11 0 1048575 sr0
253 0 6287360 dm-0
253 1 1048576 dm-1
[root@cent7 ~]# sfdisk -d /dev/sda | sfdisk /dev/sdb --force
Checking that no-one is using this disk right now ...
OK
Disk /dev/sdb: 1044 cylinders, 255 heads, 63 sectors/track
sfdisk: /dev/sdb: unrecognized partition table type
Old situation:
sfdisk: No partitions found
New situation:
Units: sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/sdb1 * 2048 2099199 2097152 83 Linux
/dev/sdb2 2099200 16777215 14678016 8e Linux LVM
/dev/sdb3 0 - 0 0 Empty
/dev/sdb4 0 - 0 0 Empty
Warning: partition 1 does not end at a cylinder boundary
Warning: partition 2 does not start at a cylinder boundary
Warning: partition 2 does not end at a cylinder boundary
Successfully wrote the new partition table
Re-reading the partition table ...
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
[root@cent7 ~]# cat /proc/partitions
major minor #blocks name
8 0 8388608 sda
8 1 1048576 sda1
8 2 7339008 sda2
8 16 8388608 sdb
8 17 1048576 sdb1
8 18 7339008 sdb2
11 0 1048575 sr0
253 0 6287360 dm-0
253 1 1048576 dm-1
Create md0
[root@cent7 ~]# mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1 --metadata=1.0
mdadm: array /dev/md0 started.
[root@cent7 ~]# mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/sdb2 --metadata=1.0
mdadm: array /dev/md1 started.
[root@cent7 ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb2[1]
7338944 blocks super 1.0 [2/1] [_U]
md0 : active raid1 sdb1[1]
1048512 blocks super 1.0 [2/1] [_U]
unused devices:
create the same type of fs for md0 using mkfs
[root@cent7 ~]# mkfs.xfs /dev/md0
meta-data=/dev/md0 isize=256 agcount=4, agsize=65532 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=262128, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=853, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
edit fstab so to replace the uuid for /dev/sda1 to /dev/md0 by looking up the uuid via blkid
[root@cent7 ~]# blkid
/dev/sda1: UUID="2e3eb107-e77f-4d4a-95ac-20882743532b" TYPE="xfs"
/dev/sda2: UUID="6URS5C-nBnn-PoSA-e2he-6lXG-AYAT-omttsz" TYPE="LVM2_member"
/dev/sdb1: UUID="c3c87400-e9d3-16fd-0505-8d9acd7becc4" UUID_SUB="8f4cb77c-de19-8d0c-62f6-4940c20f24fa" LABEL="cent7:0" TYPE="linux_raid_member"
/dev/sdb2: UUID="0867b8c2-1172-51a6-c0d2-2e2e505a31f5" UUID_SUB="291e5ce9-620f-4e3e-d64c-38821db82ad4" LABEL="cent7:1" TYPE="linux_raid_member"
/dev/mapper/cent7vg-root: UUID="7189854b-66c2-4e0c-ac17-355f0ccf4270" TYPE="xfs"
/dev/mapper/cent7vg-swap: UUID="4fffbf4d-355d-4964-8f3e-470d9d3e839c" TYPE="swap"
/dev/md0: UUID="d6041473-8b6a-43c4-9d53-80db030b3424" TYPE="xfs"
[root@cent7 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Dec 14 22:39:00 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/cent7vg-root / xfs defaults 0 0
UUID=2e3eb107-e77f-4d4a-95ac-20882743532b /boot xfs defaults 0 0
/dev/mapper/cent7vg-swap swap swap defaults 0 0
replace 2e3eb107-e77f-4d4a-95ac-20882743532b with d6041473-8b6a-43c4-9d53-80db030b3424
now to create move the pvol from sda2 to md1
[root@cent7 ~]# pvcreate /dev/md1
Physical volume "/dev/md1" successfully created
[root@cent7 ~]# vgextend cent7vg /dev/md1
Volume group "cent7vg" successfully extended
[root@cent7 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md1 cent7vg lvm2 a-- 7.00g 7.00g
/dev/sda2 cent7vg lvm2 a-- 7.00g 0
[root@cent7 ~]# pvmove /dev/sda2 /dev/md1
/dev/sda2: Moved: 0.0%
/dev/sda2: Moved: 14.3%
/dev/sda2: Moved: 39.3%
/dev/sda2: Moved: 76.4%
/dev/sda2: Moved: 100.0%
[root@cent7 ~]# vgreduce cent7vg /dev/sda2
Removed "/dev/sda2" from volume group "cent7vg"
[root@cent7 ~]# pvremove /dev/sda2
Labels on physical volume "/dev/sda2" successfully wiped
[root@cent7 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md1 cent7vg lvm2 a-- 7.00g 0
Add /dev/sda2 onto md1
[root@cent7 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md1 cent7vg lvm2 a-- 7.00g 0
[root@cent7 ~]#
[root@cent7 ~]# mdadm --add /dev/md1 /dev/sda2
mdadm: added /dev/sda2
[root@cent7 ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda2[2] sdb2[1]
7338944 blocks super 1.0 [2/1] [_U]
[==>..................] recovery = 14.8% (1091840/7338944) finish=0.6min speed=155977K/sec
md0 : active raid1 sdb1[1]
1048512 blocks super 1.0 [2/1] [_U]
unused devices:
Please wait until the sync is complete then now we have md0 with 1 disk missing and md1 that is raid1 with both disks. you can run watch cat /proc/mdstat
to look at the sync status also to speed up the sync you can run echo 100000 > /proc/sys/dev/raid/speed_limit_min
Now that our sync is complete lets create our mdadm.conf
[root@cent7 ~]# echo 100000 > /proc/sys/dev/raid/speed_limit_min
[root@cent7 ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda2[2] sdb2[1]
7338944 blocks super 1.0 [2/2] [UU]
md0 : active raid1 sdb1[1]
1048512 blocks super 1.0 [2/1] [_U]
unused devices:
[root@cent7 ~]# mdadm --examine --scan > /etc/mdadm.conf
[root@cent7 ~]# cat /etc/mdadm.conf
ARRAY /dev/md/0 metadata=1.0 UUID=c3c87400:e9d316fd:05058d9a:cd7becc4 name=cent7:0
ARRAY /dev/md/1 metadata=1.0 UUID=0867b8c2:117251a6:c0d22e2e:505a31f5 name=cent7:1
If you are using normal partitions please follow the same steps for /boot and mount and rsync the data over.
If you are using LVM like my example its much better to turn off lvmetad since it can cause issues due to caching. Edit /etc/lvm/lvm.conf and change use_lvmetad = 1 to usr_lvmetad = 0 and then issue systemctl stop lvm2-lvmetad; systemctl disable lvm2-lvmetad
Time to update our grub configs and add our md devices so that it will auto assemble during grub.
[root@cent7 ~]# mdadm -D /dev/md0 | grep UUID
UUID : c3c87400:e9d316fd:05058d9a:cd7becc4
[root@cent7 ~]# mdadm -D /dev/md1 | grep UUID
UUID : 0867b8c2:117251a6:c0d22e2e:505a31f5
Now edit /etc/default/grub and add the uuid's
BEFORE :
[root@cent7 ~]# cat /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.lvm.lv=cent7vg/root rd.lvm.lv=cent7vg/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
AFTER :
[root@cent7 ~]# cat /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="rd.md.uuid=c3c87400:e9d316fd:05058d9a:cd7becc4 rd.md.uuid=0867b8c2:117251a6:c0d22e2e:505a31f5 crashkernel=auto rd.lvm.lv=cent7vg/root rd.lvm.lv=cent7vg/swap"
GRUB_DISABLE_RECOVERY="true"
finish off grub and edit device.map
[root@cent7 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
/usr/sbin/grub2-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-3aebcd5e32a64902ae888320912f1edd
Found initrd image: /boot/initramfs-0-rescue-3aebcd5e32a64902ae888320912f1edd.img
/usr/sbin/grub2-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
done
edit /boot/grub2/device.map to show :
[root@cent7 ~]# cat /boot/grub2/device.map
# this device map was generated by anaconda
(hd0) /dev/sda
(hd1) /dev/sdb
edit /boot/grub2/grub.cfg to help find the md devices
[root@cent7 ~]# blkid
/dev/sda1: UUID="2e3eb107-e77f-4d4a-95ac-20882743532b" TYPE="xfs"
/dev/sda2: UUID="0867b8c2-1172-51a6-c0d2-2e2e505a31f5" UUID_SUB="2bb0fe28-ca4e-21c2-b407-4a2d1aadb62a" LABEL="cent7:1" TYPE="linux_raid_member"
/dev/sdb1: UUID="c3c87400-e9d3-16fd-0505-8d9acd7becc4" UUID_SUB="8f4cb77c-de19-8d0c-62f6-4940c20f24fa" LABEL="cent7:0" TYPE="linux_raid_member"
/dev/sdb2: UUID="0867b8c2-1172-51a6-c0d2-2e2e505a31f5" UUID_SUB="291e5ce9-620f-4e3e-d64c-38821db82ad4" LABEL="cent7:1" TYPE="linux_raid_member"
/dev/mapper/cent7vg-swap: UUID="4fffbf4d-355d-4964-8f3e-470d9d3e839c" TYPE="swap"
/dev/md0: UUID="d6041473-8b6a-43c4-9d53-80db030b3424" TYPE="xfs"
/dev/md1: UUID="fTsdk5-a31t-fiVZ-eyKk-Q8nE-lb78-aC4o01" TYPE="LVM2_member"
/dev/dm-0: UUID="7189854b-66c2-4e0c-ac17-355f0ccf4270" TYPE="xfs"
in /boot/grub2/grub.cfg find lines similar to
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal
=ahci0,msdos1 --hint='hd0,msdos1' 2e3eb107-e77f-4d4a-95ac-20882743532b
else
search --no-floppy --fs-uuid --set=root 2e3eb107-e77f-4d4a-95ac-20882743532b
and replace the uuid's with uuid's from md0 and md1. In my case i will replace 2e3eb107-e77f-4d4a-95ac-20882743532b with d6041473-8b6a-43c4-9d53-80db030b3424
generate the new initramfs (make sure your /etc/mdadm.conf exists)
[root@cent7 ~]# cd /boot
[root@cent7 boot]# ls
config-3.10.0-327.el7.x86_64 initrd-plymouth.img
grub symvers-3.10.0-327.el7.x86_64.gz
grub2 System.map-3.10.0-327.el7.x86_64
initramfs-0-rescue-3aebcd5e32a64902ae888320912f1edd.img vmlinuz-0-rescue-3aebcd5e32a64902ae888320912f1edd
initramfs-3.10.0-327.el7.x86_64.img vmlinuz-3.10.0-327.el7.x86_64
initramfs-3.10.0-327.el7.x86_64kdump.img
[root@cent7 boot]# mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak
[root@cent7 boot]# dracut -f --mdadmconf
[root@cent7 boot]# cat /etc/mdadm.conf
ARRAY /dev/md/0 metadata=1.0 UUID=c3c87400:e9d316fd:05058d9a:cd7becc4 name=cent7:0
ARRAY /dev/md/1 metadata=1.0 UUID=0867b8c2:117251a6:c0d22e2e:505a31f5 name=cent7:1
[root@cent7 boot]# ls
config-3.10.0-327.el7.x86_64 initramfs-3.10.0-327.el7.x86_64kdump.img
grub initrd-plymouth.img
grub2 symvers-3.10.0-327.el7.x86_64.gz
initramfs-0-rescue-3aebcd5e32a64902ae888320912f1edd.img System.map-3.10.0-327.el7.x86_64
initramfs-3.10.0-327.el7.x86_64.img vmlinuz-0-rescue-3aebcd5e32a64902ae888320912f1edd
initramfs-3.10.0-327.el7.x86_64.img.12-15-004026.bak vmlinuz-3.10.0-327.el7.x86_64
mount and rsync /boot to md0
[root@cent7 ~]# mount /dev/md0 /mnt
[root@cent7 ~]# rsync -ravt /boot/ /mnt/
sending incremental file list
./
.vmlinuz-3.10.0-327.el7.x86_64.hmac
System.map-3.10.0-327.el7.x86_64
config-3.10.0-327.el7.x86_64
initramfs-0-rescue-3aebcd5e32a64902ae888320912f1edd.img
initramfs-3.10.0-327.el7.x86_64.img
initramfs-3.10.0-327.el7.x86_64kdump.img
initrd-plymouth.img
symvers-3.10.0-327.el7.x86_64.gz
vmlinuz-0-rescue-3aebcd5e32a64902ae888320912f1edd
vmlinuz-3.10.0-327.el7.x86_64
grub/
grub/splash.xpm.gz
grub2/
grub2/device.map
grub2/grub.cfg
grub2/grubenv
grub2/fonts/
grub2/fonts/unicode.pf2
grub2/i386-pc/
grub2/i386-pc/acpi.mod
grub2/i386-pc/adler32.mod
grub2/i386-pc/affs.mod
grub2/i386-pc/afs.mod
grub2/i386-pc/ahci.mod
grub2/i386-pc/all_video.mod
grub2/i386-pc/aout.mod
grub2/i386-pc/archelp.mod
grub2/i386-pc/at_keyboard.mod
grub2/i386-pc/ata.mod
grub2/i386-pc/backtrace.mod
grub2/i386-pc/bfs.mod
grub2/i386-pc/biosdisk.mod
grub2/i386-pc/bitmap.mod
grub2/i386-pc/bitmap_scale.mod
grub2/i386-pc/blocklist.mod
grub2/i386-pc/blscfg.mod
grub2/i386-pc/boot.img
grub2/i386-pc/boot.mod
grub2/i386-pc/bsd.mod
grub2/i386-pc/btrfs.mod
grub2/i386-pc/bufio.mod
grub2/i386-pc/cat.mod
grub2/i386-pc/cbfs.mod
grub2/i386-pc/cbls.mod
grub2/i386-pc/cbmemc.mod
grub2/i386-pc/cbtable.mod
grub2/i386-pc/cbtime.mod
grub2/i386-pc/chain.mod
grub2/i386-pc/cmdline_cat_test.mod
grub2/i386-pc/cmosdump.mod
grub2/i386-pc/cmostest.mod
grub2/i386-pc/cmp.mod
grub2/i386-pc/command.lst
grub2/i386-pc/configfile.mod
grub2/i386-pc/core.img
grub2/i386-pc/cpio.mod
grub2/i386-pc/cpio_be.mod
grub2/i386-pc/cpuid.mod
grub2/i386-pc/crc64.mod
grub2/i386-pc/crypto.lst
grub2/i386-pc/crypto.mod
grub2/i386-pc/cryptodisk.mod
grub2/i386-pc/cs5536.mod
grub2/i386-pc/date.mod
grub2/i386-pc/datehook.mod
grub2/i386-pc/datetime.mod
grub2/i386-pc/disk.mod
grub2/i386-pc/diskfilter.mod
grub2/i386-pc/div_test.mod
grub2/i386-pc/dm_nv.mod
grub2/i386-pc/drivemap.mod
grub2/i386-pc/echo.mod
grub2/i386-pc/efiemu.mod
grub2/i386-pc/efiemu32.o
grub2/i386-pc/efiemu64.o
grub2/i386-pc/ehci.mod
grub2/i386-pc/elf.mod
grub2/i386-pc/eval.mod
grub2/i386-pc/exfat.mod
grub2/i386-pc/exfctest.mod
grub2/i386-pc/ext2.mod
grub2/i386-pc/extcmd.mod
grub2/i386-pc/fat.mod
grub2/i386-pc/file.mod
grub2/i386-pc/font.mod
grub2/i386-pc/freedos.mod
grub2/i386-pc/fs.lst
grub2/i386-pc/fshelp.mod
grub2/i386-pc/functional_test.mod
grub2/i386-pc/gcry_arcfour.mod
grub2/i386-pc/gcry_blowfish.mod
grub2/i386-pc/gcry_camellia.mod
grub2/i386-pc/gcry_cast5.mod
grub2/i386-pc/gcry_crc.mod
grub2/i386-pc/gcry_des.mod
grub2/i386-pc/gcry_dsa.mod
grub2/i386-pc/gcry_idea.mod
grub2/i386-pc/gcry_md4.mod
grub2/i386-pc/gcry_md5.mod
grub2/i386-pc/gcry_rfc2268.mod
grub2/i386-pc/gcry_rijndael.mod
grub2/i386-pc/gcry_rmd160.mod
grub2/i386-pc/gcry_rsa.mod
grub2/i386-pc/gcry_seed.mod
grub2/i386-pc/gcry_serpent.mod
grub2/i386-pc/gcry_sha1.mod
grub2/i386-pc/gcry_sha256.mod
grub2/i386-pc/gcry_sha512.mod
grub2/i386-pc/gcry_tiger.mod
grub2/i386-pc/gcry_twofish.mod
grub2/i386-pc/gcry_whirlpool.mod
grub2/i386-pc/gdb.mod
grub2/i386-pc/geli.mod
grub2/i386-pc/gettext.mod
grub2/i386-pc/gfxmenu.mod
grub2/i386-pc/gfxterm.mod
grub2/i386-pc/gfxterm_background.mod
grub2/i386-pc/gfxterm_menu.mod
grub2/i386-pc/gptsync.mod
grub2/i386-pc/gzio.mod
grub2/i386-pc/halt.mod
grub2/i386-pc/hashsum.mod
grub2/i386-pc/hdparm.mod
grub2/i386-pc/hello.mod
grub2/i386-pc/help.mod
grub2/i386-pc/hexdump.mod
grub2/i386-pc/hfs.mod
grub2/i386-pc/hfsplus.mod
grub2/i386-pc/hfspluscomp.mod
grub2/i386-pc/http.mod
grub2/i386-pc/iorw.mod
grub2/i386-pc/iso9660.mod
grub2/i386-pc/jfs.mod
grub2/i386-pc/jpeg.mod
grub2/i386-pc/keylayouts.mod
grub2/i386-pc/keystatus.mod
grub2/i386-pc/ldm.mod
grub2/i386-pc/legacy_password_test.mod
grub2/i386-pc/legacycfg.mod
grub2/i386-pc/linux.mod
grub2/i386-pc/linux16.mod
grub2/i386-pc/loadenv.mod
grub2/i386-pc/loopback.mod
grub2/i386-pc/ls.mod
grub2/i386-pc/lsacpi.mod
grub2/i386-pc/lsapm.mod
grub2/i386-pc/lsmmap.mod
grub2/i386-pc/lspci.mod
grub2/i386-pc/luks.mod
grub2/i386-pc/lvm.mod
grub2/i386-pc/lzopio.mod
grub2/i386-pc/macbless.mod
grub2/i386-pc/macho.mod
grub2/i386-pc/mda_text.mod
grub2/i386-pc/mdraid09.mod
grub2/i386-pc/mdraid09_be.mod
grub2/i386-pc/mdraid1x.mod
grub2/i386-pc/memdisk.mod
grub2/i386-pc/memrw.mod
grub2/i386-pc/minicmd.mod
grub2/i386-pc/minix.mod
grub2/i386-pc/minix2.mod
grub2/i386-pc/minix2_be.mod
grub2/i386-pc/minix3.mod
grub2/i386-pc/minix3_be.mod
grub2/i386-pc/minix_be.mod
grub2/i386-pc/mmap.mod
grub2/i386-pc/moddep.lst
grub2/i386-pc/modinfo.sh
grub2/i386-pc/morse.mod
grub2/i386-pc/mpi.mod
grub2/i386-pc/msdospart.mod
grub2/i386-pc/multiboot.mod
grub2/i386-pc/multiboot2.mod
grub2/i386-pc/nativedisk.mod
grub2/i386-pc/net.mod
grub2/i386-pc/newc.mod
grub2/i386-pc/nilfs2.mod
grub2/i386-pc/normal.mod
grub2/i386-pc/ntfs.mod
grub2/i386-pc/ntfscomp.mod
grub2/i386-pc/ntldr.mod
grub2/i386-pc/odc.mod
grub2/i386-pc/offsetio.mod
grub2/i386-pc/ohci.mod
grub2/i386-pc/part_acorn.mod
grub2/i386-pc/part_amiga.mod
grub2/i386-pc/part_apple.mod
grub2/i386-pc/part_bsd.mod
grub2/i386-pc/part_dfly.mod
grub2/i386-pc/part_dvh.mod
grub2/i386-pc/part_gpt.mod
grub2/i386-pc/part_msdos.mod
grub2/i386-pc/part_plan.mod
grub2/i386-pc/part_sun.mod
grub2/i386-pc/part_sunpc.mod
grub2/i386-pc/partmap.lst
grub2/i386-pc/parttool.lst
grub2/i386-pc/parttool.mod
grub2/i386-pc/password.mod
grub2/i386-pc/password_pbkdf2.mod
grub2/i386-pc/pata.mod
grub2/i386-pc/pbkdf2.mod
grub2/i386-pc/pbkdf2_test.mod
grub2/i386-pc/pci.mod
grub2/i386-pc/pcidump.mod
grub2/i386-pc/plan9.mod
grub2/i386-pc/play.mod
grub2/i386-pc/png.mod
grub2/i386-pc/priority_queue.mod
grub2/i386-pc/probe.mod
grub2/i386-pc/procfs.mod
grub2/i386-pc/progress.mod
grub2/i386-pc/pxe.mod
grub2/i386-pc/pxechain.mod
grub2/i386-pc/raid5rec.mod
grub2/i386-pc/raid6rec.mod
grub2/i386-pc/read.mod
grub2/i386-pc/reboot.mod
grub2/i386-pc/regexp.mod
grub2/i386-pc/reiserfs.mod
grub2/i386-pc/relocator.mod
grub2/i386-pc/romfs.mod
grub2/i386-pc/scsi.mod
grub2/i386-pc/search.mod
grub2/i386-pc/search_fs_file.mod
grub2/i386-pc/search_fs_uuid.mod
grub2/i386-pc/search_label.mod
grub2/i386-pc/sendkey.mod
grub2/i386-pc/serial.mod
grub2/i386-pc/setjmp.mod
grub2/i386-pc/setjmp_test.mod
grub2/i386-pc/setpci.mod
grub2/i386-pc/sfs.mod
grub2/i386-pc/signature_test.mod
grub2/i386-pc/sleep.mod
grub2/i386-pc/sleep_test.mod
grub2/i386-pc/spkmodem.mod
grub2/i386-pc/squash4.mod
grub2/i386-pc/syslinuxcfg.mod
grub2/i386-pc/tar.mod
grub2/i386-pc/terminal.lst
grub2/i386-pc/terminal.mod
grub2/i386-pc/terminfo.mod
grub2/i386-pc/test.mod
grub2/i386-pc/test_blockarg.mod
grub2/i386-pc/testload.mod
grub2/i386-pc/testspeed.mod
grub2/i386-pc/tftp.mod
grub2/i386-pc/tga.mod
grub2/i386-pc/time.mod
grub2/i386-pc/tr.mod
grub2/i386-pc/trig.mod
grub2/i386-pc/true.mod
grub2/i386-pc/truecrypt.mod
grub2/i386-pc/udf.mod
grub2/i386-pc/ufs1.mod
grub2/i386-pc/ufs1_be.mod
grub2/i386-pc/ufs2.mod
grub2/i386-pc/uhci.mod
grub2/i386-pc/usb.mod
grub2/i386-pc/usb_keyboard.mod
grub2/i386-pc/usbms.mod
grub2/i386-pc/usbserial_common.mod
grub2/i386-pc/usbserial_ftdi.mod
grub2/i386-pc/usbserial_pl2303.mod
grub2/i386-pc/usbserial_usbdebug.mod
grub2/i386-pc/usbtest.mod
grub2/i386-pc/vbe.mod
grub2/i386-pc/verify.mod
grub2/i386-pc/vga.mod
grub2/i386-pc/vga_text.mod
grub2/i386-pc/video.lst
grub2/i386-pc/video.mod
grub2/i386-pc/video_bochs.mod
grub2/i386-pc/video_cirrus.mod
grub2/i386-pc/video_colors.mod
grub2/i386-pc/video_fb.mod
grub2/i386-pc/videoinfo.mod
grub2/i386-pc/videotest.mod
grub2/i386-pc/videotest_checksum.mod
grub2/i386-pc/xfs.mod
grub2/i386-pc/xnu.mod
grub2/i386-pc/xnu_uuid.mod
grub2/i386-pc/xnu_uuid_test.mod
grub2/i386-pc/xzio.mod
grub2/i386-pc/zfs.mod
grub2/i386-pc/zfscrypt.mod
grub2/i386-pc/zfsinfo.mod
grub2/locale/
grub2/locale/ast.mo
grub2/locale/ca.mo
grub2/locale/da.mo
grub2/locale/de.mo
grub2/locale/de@hebrew.mo
grub2/locale/de_CH.mo
grub2/locale/en.mo
grub2/locale/en@arabic.mo
grub2/locale/en@cyrillic.mo
grub2/locale/en@greek.mo
grub2/locale/en@hebrew.mo
grub2/locale/en@piglatin.mo
grub2/locale/en@quot.mo
grub2/locale/eo.mo
grub2/locale/es.mo
grub2/locale/fi.mo
grub2/locale/fr.mo
grub2/locale/gl.mo
grub2/locale/hu.mo
grub2/locale/id.mo
grub2/locale/it.mo
grub2/locale/ja.mo
grub2/locale/lt.mo
grub2/locale/nl.mo
grub2/locale/pa.mo
grub2/locale/pl.mo
grub2/locale/pt_BR.mo
grub2/locale/ru.mo
grub2/locale/sl.mo
grub2/locale/sv.mo
grub2/locale/tr.mo
grub2/locale/uk.mo
grub2/locale/vi.mo
grub2/locale/zh_CN.mo
grub2/locale/zh_TW.mo
grub2/themes/
grub2/themes/system/
sent 102298416 bytes received 6123 bytes 29229868.29 bytes/sec
total size is 102266993 speedup is 1.00
reinstall grub2 on both disks
[root@cent7 ~]# grub2-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
[root@cent7 ~]# grub2-install /dev/sdb
Installing for i386-pc platform.
Installation finished. No error reported.
now reboot!
After the system is up we should have md0 still with just 1 disk and md1 with both disks in sync. mount/df shows that /boot is mounted from /dev/md0 which is what we want and pvs shows /dev/md1
[root@cent7 ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb2[1] sda2[2]
7338944 blocks super 1.0 [2/2] [UU]
md0 : active raid1 sdb1[1]
1048512 blocks super 1.0 [2/1] [_U]
unused devices:
[root@cent7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cent7vg-root 6.0G 892M 5.2G 15% /
devtmpfs 487M 0 487M 0% /dev
tmpfs 497M 0 497M 0% /dev/shm
tmpfs 497M 6.6M 490M 2% /run
tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/md0 1021M 149M 872M 15% /boot
tmpfs 100M 0 100M 0% /run/user/0
[root@cent7 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md1 cent7vg lvm2 a-- 7.00g 0
Now to add /dev/sda1 onto /dev/md0 and make sure that it is in sync and perform a final clean reboot
[root@cent7 ~]# mdadm --add /dev/md0 /dev/sda1
mdadm: added /dev/sda1
[root@cent7 ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb2[1] sda2[2]
7338944 blocks super 1.0 [2/2] [UU]
md0 : active raid1 sda1[2] sdb1[1]
1048512 blocks super 1.0 [2/1] [_U]
[=>...................] recovery = 8.3% (88064/1048512) finish=0.7min speed=22016K/sec
unused devices:
wait until the sync is complete and reboot.
and now we have a fully redundant system
[root@cent7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cent7vg-root 6.0G 888M 5.2G 15% /
devtmpfs 487M 0 487M 0% /dev
tmpfs 497M 0 497M 0% /dev/shm
tmpfs 497M 6.6M 490M 2% /run
tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/md0 1021M 150M 872M 15% /boot
tmpfs 100M 0 100M 0% /run/user/0
[root@cent7 ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb2[1] sda2[2]
7338944 blocks super 1.0 [2/2] [UU]
md0 : active raid1 sdb1[1] sda1[2]
1048512 blocks super 1.0 [2/2] [UU]
unused devices:
[root@cent7 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md1 cent7vg lvm2 a-- 7.00g 0
for cleanliness lets generate our grub.cfg again
[root@cent7 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-3aebcd5e32a64902ae888320912f1edd
Found initrd image: /boot/initramfs-0-rescue-3aebcd5e32a64902ae888320912f1edd.img
done
Complete!
Again i've tested this method on several machines and it seems to work great! I am sure that there might be a better shorter way of doing this but this has worked for me