The below info is only super quick notes during a clone I ran recently,
this is not a Â complete HOW-TO!!
My preference is to use LVM snapshot backups using fsarchiver.
I typically have a layout like so:
/dev/md0 Â – Â /boot
/dev/md1 – LVM PV
/dev/vg1/root – root
(I may split out /root further, but depends on my build needs, usually not anymore)
With the above I use my own script that auto-creates an lvm snapshot,
runs fsarchiver to backup, and dismount/clear the snapshot. Â I take
those .fsa files and recover to new system. Â I also do a
“read-only” remount on /dev/md0 /boot to fsarchiver directly.
(this could be dangerous, but has never failed me in 8-10 years)
——————- Â NOTES/PROCEDURE ——————
Centos 7 clone server Get FSA clones from orig. Launch Live Install CD for CentOS7 - into troubleshooting, rescue, Skip any mounts and go into shell. Create Partitions NOTE: if on >2TB , make it a GPT partition! Make sure 1M part1 is bios_grub type!! And raid type on MD's Create MDâ€™s. *** IMPORTANT *** ** HOMEHOST ISSUES ** make sure there is not mdadm.conf with any hostname settings, remove otherwise. Also CREATE with a â€”name directive and label it. (this is not the hostname) mdadm --create /dev/md0 --metadata=1.2 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2 ## then stop mdadm â€”stop /dev/md0 ## then reassemble mdadm --assemble /dev/md0 /dev/sda2 /dev/sdb2 --update=name --name=boot --homehost="<none>â€ (-- if you copy above lines, might be messed up wordpress html) **NOTE** if home host issues come up on first boot, when stuck in dracut prompt, you can stop and reassemble to reset those names and host settings. **NOTE** When all is said and done, make sure the final mdadm.conf is set with: (notice /dev/md/0 not md0! â€” and the device/homehost settings!) ******************** DEVICE partitions HOMEHOST <ignore> AUTO +1.x +imsm -all ARRAY /dev/md/0 metadata=1.2 name=boot UUID=65cc434a:33516f02:17909f3c:74005756 ARRAY /dev/md/1 metadata=1.2 name=rootlvm UUID=030cd899:987aec61:e348e3db:35b62748 *********************
#### EDIT 4-24-15 ####
The last clone I just did, DID NOT use /dev/md/0 format,
it used /dev/md0 without error, so try this way too.
However, see notes update below about UUID’s and grub.cfg default command line.
#### END EDIT ####
Create your PV > VG > LVâ€™s
Do mounts and Chroot env.
â€” make sure to setup the mdadm.conf correctly in chroot.
â€” check and fix anything in /etc/fstab
< UUID mounts and maybe /dev/md0 needs set?
â€” if not already, /etc/dracut.conf.d/
< add md.conf < set the mdconfig and lvmconfig
variables. (review dracut.conf as example) this is
needed before initramfs. (might be set form another before!)
â€” Do a dracut initramfs build
Youâ€™ll need to do
â€œdracut -f -v /boot/initramfs-.img â€
plus just a â€œdracut -f -vâ€ for current kern.
â€” then check any needed in /etc/default/grub
**** IMPORTANT (edit 4-24-15) Change the /etc/default/grub
section for GRUB_CMDLINE_LINUX if you have rd.md.uuid entries!!!!!
See notes below in edit.
â€” grub2-mkconfig -o /boot/grub2/grub.cfg
â€” grub2-install –modules=”part_gpt mdraid09 mdraid1x lvm” /dev/sda
(and for other drive to bootable)
â€” exit chroot and umounts
Should be able to reboot!
Once loaded (fix further if not) then check the mdadm.conf
and lvm.conf and fstab.
If doing any other ZFS, might need to
reset hostid and hostname!!!!!!
Or else might not reimport on reboot.
< set the current new hostname
< set that new hostname in the localhost line
â€œ dd if=/dev/urandom of=/etc/hostid bs=4 count=1 â€œ
<< resets a new hostid
Prob just ned to fix/change any ifcfg scripts.
Should be all downhill from here!
#### EDIT NOTES 4-24-15 ####
Again, I ran into issues cloning. Turns out I left entries in /etc/default/grub for the UUID’s of the old system. See this example (not the full line, and should be single line):
GRUB_CMDLINE_LINUX=" rd.auto rd.auto=1 rd.md.uuid=c2d08888:8e4464ae:3d321966:fd1111cc rd.md.uuid=bbd483af:95088699:76e2826e:14b6dc4f rd.lvm.lv=vg1/root
DONT FORGET to change those rd.md.uuid entries or it won’t boot!
Get your current UUID’s like so:
mdadm –detail /dev/md0 (and /dev/md1 too)
The UUID listed in those details is what you need on each rd.md.uuid entry.
Maybe it works without those in there, but grub wouldn’t find the md devices and dracut/initramfs bootup would not assemble my arrays until I changed them. The partitions and arrays were there though, and I was dropped to a dracut prompt. From there I could manually assemble and boot, which allowed me to change the line above and then re-run grub2-mkconfig.
Just quick note while on dracut prompt. Manually assemble:
mdadm --assemble /dev/md0 mdadm --assemble /dev/md1 lvm vgchange -a y vg1 exit
That booted my system. After fixing /etc/default/grub and re-running grub2-mkconfig all was good!