Cloning a Centos7 installation
-
I would like to clone my CentOS 7 and my CentOS 7+ Fog 4752 Hyper-V VMs onto a physical machines.
It is a minimal installation on a single disk. I’m just installing the OS, then shutting down to capture then deploy, and for the FOG install, doing my usual thang.
Each time, build 4752 captures the way it’s meant to, then deploys without issue, but when Centos tries to boot, it dumps to Dracut.
I have tried installing it with LVM and the XFS File System, with Standard Partitions, and ext4 File System.
This is the dump from a pure LVM attempt:
Reached: Target Paths Reached: Target Basic System Warning: Could not boot Warning: /dev/centos_centos7/root does not exist Warning: /dev/centos_centos7/swap does not exist Warning: /dev/mapper/centos_centos7-root does not exist Starting Dracut Emergency Shell... ... Entering emergency mode.
What have I done wrong this time?
-
I’m going to try a different box and see if it may be a hardware compatibility issue.
BTW, on the completed VM with FOG, SELinux is disabled.
-
Okay, so that’s the deal. The controller.
The changing disk controller tripped it up.
I turned off AHCI mode on the physical box and it now works.
The next step is, how can I fix this so I can retain the benefits of AHCI over compatibility mode?
-
Could a moderator move this thread into Linux problems for me please?
So I found this very specific page: How to install the AHCI mode drivers in an existing installation of CentOS that only has IDE support … but it didn’t work.
-
Add the line: “alias scsi_hostadapter ahci” to /etc/modprobe.conf
-
Rebuild your initrd with this command:
mkinitrd -f -v /boot/initrd-$(uname -r).ahci.img $(uname -r) -
Rename the old init.rd to a backup and mv the new one where the old one was:
mv /boot/initrd-$(uname -r).img /boot/initrd-$(uname -r).img.bak
mv /boot/initrd-$(uname -r).ahci.img /boot/initrd-$(uname -r).img
That first part of #3 can’t find the file on my LVM sample.
-
-
-
What are you using to clone? Fog? Clonezilla?
-
FOG of course. Build 4752 to be precise.
-
@sudburr Do you think that because you chose the “minimal” installation, that it only installed the drivers it needed to operate? Perhaps if you did a full installation, it might have the drivers already. Just a thought.
I don’t know much about drivers in Linux… it’s totally foreign to me to be completely honest. I wish someone could explain it to me in a way that didn’t involve rocket science or learning assembly language.
-
I thought of that too. I just installed an infrastructure server with a bunch of file storage drivers. I will know tomorrow how it is.
-
So I found this very specific page: How to install the AHCI mode drivers in an existing installation of CentOS that only has IDE support … but it didn’t work.
Add the line: “alias scsi_hostadapter ahci” to /etc/modprobe.conf
Rebuild your initrd with this command:
mkinitrd -f -v /boot/initrd-$(uname -r).ahci.img $(uname -r)Rename the old init.rd to a backup and mv the new one where the old one was:
mv /boot/initrd-$(uname -r).img /boot/initrd-$(uname -r).img.bak
mv /boot/initrd-$(uname -r).ahci.img /boot/initrd-$(uname -r).imgThat first part of #3 can’t find the file on my LVM sample.
Maybe the file was just named a little different on your system. There definitely should be something like /boot/init… on your system.
-
So the problem isn’t the cloning but that I was transferring from an IDE/Compatible VM to an Physical system with AHCI enabled. Setting the physical to IDE/Compatible mode fixed that. However IDE mode is not a solution. I required building AHCI into the kernel prior to deployment.
Thanks to some help from centos.org forums I have a working solution.
I’ve moved the OS update and some other new code that forces the recompiled kernel to include AHCI drivers to the final mastering.
Server building occurs for me in several steps.
- Install the Minimal Server to a VM, nothing else, no updates
- Purpose the VM (in this case for FOG and all that entails, no updates)
- Master the image (every update and generalizing code)
- Capture the image
- Distribute the image
- Align the Deployed system
I’ve added the following code to the Mastering:
03> Master the Image ## Login REMOTELY with Kitty ( http://kitty.9bis.net/ ) ## Elevate Access Level ## -- ## Disable root access via SSH (CentOS only) ## Direct next Kernel recompilation update to include AHCI drivers & be HW generic ## Clean & Update the OS ## Shutdown sudo su if [ -f /etc/centos-release ]; then sed -i "s|#PermitRootLogin yes|PermitRootLogin no|g" /etc/ssh/sshd_config systemctl restart sshd.service sed -i 's|#add_drivers+="|add_drivers+="ahci|g' /etc/dracut.conf sed -i 's|#hostonly="yes|hostonly="no|g' /etc/dracut.conf yum clean all yum makecache yum update -y shutdown now fi