LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 06-20-2013, 12:56 PM   #1
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 232
Blog Entries: 1

Rep: Reputation: 17
Cloning workstation to slightly different hardware


Hello all. The goal is to clone an existing workstation to another piece of hardware for the purpose of testing updates, patches and vulnerability fixes so that the original piece of hardware doesn't break application functionality. The workstation to be cloned is a Dell T7500 with two hard drives. The partition is setup as follows:
/dev/sda1 /boot
/dev/mapper/vg_vol00-lv_root /
/dev/mapper/vg_vol00-lv_home /home
/dev/sdb1 /root/backup

/dev/sda is a 500GB hard drive
/dev/sdb is a 1TB hard drive

The version of Red Hat is 64-bit Red Hat Enterprise Linux Workstation Release 6.0 (Santiago)

What I've done thus far.

I rebooted into Knoppix on this machine and attached a 1TB external hard drive (via USB) and ran the following command:
dd if=/dev/sda of=/dev/sdc bs=100MB conv=notrunc,noerror

I then plugged up a second hard drive upon completion of the first step and ran the following command:
dd if=/dev/sda of=/dev/sdc bs=4096 conv=notrunc,noerror

After both hard drives completed the dd operation (each of them errored saying no space left on device, but, as I understand it, this isn't something to be concerned about per se), I placed the cloned drives into a Dell T7600 workstation which has newer hardware. When I booted it up, I see the Red Hat progress meter at the bottom of the screen, and, as the progress meter got to about half way across the bottom of the screen, I get the following message:
"No root device found.
Boot has failed, sleeping forever"

So, some things to point out here:
* Newer hardware
* bs was different than the first dd command, but I didn't think that mattered. I was just messing with bs to see if I could get it to go faster

Would it be possible to boot from a Red Hat disk into linux rescue and somehow inject parameters to allow the machine to boot? I can see the data after having mounted to /mnt/sysimage via Knoppix, but obviously something isn't liked by the new hardware.

Additionally, I've gone through the BIOS settings to match parameters as identical as I could from the original hardware.

Is what I'm attempting futile? If I have to completely give up on cloning, is there an easy way to get a machine to act exactly like another one? I've been looking at Clonezilla and FOG, but I'm thinking they won't cater to my specific needs here.

Any/all ideas would be greatly appreciated.

Last edited by loadedmind; 06-20-2013 at 12:57 PM.
 
Old 06-20-2013, 02:04 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 1,985

Rep: Reputation: Disabled
Quote:
Originally Posted by loadedmind View Post
I rebooted into Knoppix on this machine and attached a 1TB external hard drive (via USB) and ran the following command:
dd if=/dev/sda of=/dev/sdc bs=100MB conv=notrunc,noerror

I then plugged up a second hard drive upon completion of the first step and ran the following command:
dd if=/dev/sda of=/dev/sdc bs=4096 conv=notrunc,noerror
The second command is supposed to refer to /dev/sdb, right?
Quote:
Originally Posted by loadedmind View Post
After both hard drives completed the dd operation (each of them errored saying no space left on device, but, as I understand it, this isn't something to be concerned about per se),
That is very much something to be concerned about, because it means dd ran out of space on the destination device. Your drive images are incomplete.

Quote:
Originally Posted by loadedmind View Post
I placed the cloned drives into a Dell T7600 workstation which has newer hardware. When I booted it up, I see the Red Hat progress meter at the bottom of the screen, and, as the progress meter got to about half way across the bottom of the screen, I get the following message:
"No root device found.
Boot has failed, sleeping forever"
AFAIK, Red Hat boots using an inird, and my guess is your current initrd doesn't contain the necessary modules (drivers) for your new disk controller. That, or vital parts of the file system is missing due to the truncated image.

You should rebuild the initrd on the old system (if at all possible), adding the relevant module(s). The alternative is to manually edit the existing initrd or add a new initrd using Knoppix a similar Live CD, or perhaps see if the Red Hat installer has a "rescue" or "repair" function (disclaimer: I know nothing about RHEL).

You should be able to see which modules are needed from within Knoppix. lspci (on the new system, obviously) would be a good start.
 
Old 06-20-2013, 02:11 PM   #3
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 232
Blog Entries: 1

Original Poster
Rep: Reputation: 17
You're right, of course. The second should've been /dev/sdb. Thanks for catching that.

So, if the hard drives in the system to be cloned are 1TB and the external hard drives that are to go in the new system to act as the test box with identical configuration from the first are ALSO 1TB HDD's, what am I missing here? A flag/switch in the dd command or something? Is there a better way to copy the data over bit for bit?

The initrd option is an entirely new concept to me and I really don't think I'll be able to rebuild on the original machine because of how mission critical it is. Perhaps I just need to focus on obtaining an accurate clone of the hard drives and go from there?

By the way, I get the same exact error message (upon dd's completion) for both hard drive clones.
 
Old 06-20-2013, 02:42 PM   #4
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,101

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
cloning a linux install doesn't necessarily require DD, simply partitioning, formatting, copying the files and setting up the new system using a live cd
make sure the new drive is in the position it's going to be, and the old data is available either via attaching the drive in a secondary position or via a network share (preferably the former)

boot to a live cd
Code:
# mkdir /{oldsys,newsys}
# mount /dev/sda1 /newsys
# mount /dev/sdb1 /oldsys
# mount /dev/sda2 /newsys/boot
# mount /dev/sdb2 /oldsys/boot
# etc...
# cp -rv --preserve=all /oldsys/* /newsys
# for file in {proc,sys,dev}
> do
> mount --bind /$dir /newsys/$dir
> done
# chroot /newsys
replacing sda1 with the volume of your new system and sdb1 with the volume of your old system
at this point the terminal would be as if you had booted the system on /newsys
re-build the initramfs and install grub (or whatever bootloader you use) on the new drive
assuming everything went ok you should be able to shut down, remove the old drive, and have a bootable system on the new drive next time you poweron the machine

note, sub partitions would be mounted AFTER the initial partitions

Last edited by frieza; 06-20-2013 at 02:45 PM.
 
Old 06-20-2013, 03:28 PM   #5
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 1,985

Rep: Reputation: Disabled
Quote:
Originally Posted by loadedmind View Post
The initrd option is an entirely new concept to me and I really don't think I'll be able to rebuild on the original machine because of how mission critical it is.
The initrd is just a file containing a small file system to serve temporarily as root during the boot process. It makes it possible to keep the kernel small and lean; you just add the necessary modules to the initrd to make the kernel detect your disk controller or whatever device connects to the root file system. If one doesn't use an initrd, the required disk controller driver must be compiled into the kernel.

Rebuilding an initrd isn't a big deal at all. Usually, every distribution has a script to do the job for you, and anyway you don't have to delete or replace the existing initrd, just create a new one and add a new boot option to GRUB.

Quote:
Originally Posted by loadedmind View Post
Perhaps I just need to focus on obtaining an accurate clone of the hard drives and go from there?

By the way, I get the same exact error message (upon dd's completion) for both hard drive clones.
Check the size of both drives with fdisk -l. If the number of sectors on the destination drive is smaller than that of the source drive, a straight dd clone won't work. frieza's method would work, though.

If the destination drives are the same size or bigger, the issue is probably your choice of block size for dd. In that case, the error message is indeed purely cosmetic (and your boot problems are guaranteed to be driver/module related).

I've found block sizes larger than 8192 to have very little effect on performance, and since most drives have a sector number divisible by 16 (for older drives with 512 byte sectors) or 2 (newer drives with 4096 byte sectors), you won't get an error message as dd tries to write past the end of the device.

Last edited by Ser Olmy; 06-20-2013 at 03:29 PM.
 
Old 06-20-2013, 06:44 PM   #6
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 232
Blog Entries: 1

Original Poster
Rep: Reputation: 17
Thanks so much for all the words of wisdom. Is extremely appreciated. I'll try first thing in the morning.
 
Old 07-18-2013, 09:17 AM   #7
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 232
Blog Entries: 1

Original Poster
Rep: Reputation: 17
It ended up that this wouldn't work because there was a bit or two less seen by the clone tool (Clonezilla) which was causing it to fail. Although I haven't tried it, the suggested fix was to use a tool such as gparted and resize the origin disk to slighly smaller size so that the clone operation would move on.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Move SLES Image to Unlike Hardware - Cloning iamiams Linux - General 4 04-14-2008 01:37 PM
VMWare Workstation on Ubuntu - how much hardware required? taylorkh Linux - Software 2 01-02-2008 05:50 AM
Cloning system to different hardware platform twk Linux - Hardware 1 12-18-2006 01:13 PM
HP B2000 Workstation Hard disk cloning xgreen Other *NIX 0 06-19-2006 11:13 AM
Ultra 5 workstation - hardware compatibility frankie_DJ Solaris / OpenSolaris 3 07-06-2005 02:13 PM


All times are GMT -5. The time now is 08:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration