LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-31-2014, 09:46 AM   #1
wtb
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Rep: Reputation: 0
Copy disk to disk between servers


Hi,

I would like to "clone" manually the disks from a server to another.

The situation is :

1. On one side I have a physical server (RHEL 5.6) with two disks : 'sdb' for the OS, cut in several partitions and sda for datas

2. On the other side I'v created a VM (RHEL 5.6) with two disks

What I want is to copy the entire datas and filesystems from 1. to 2. and start my VM in the same state like if I was on my physical server.

But I don't know how to do this... Can i "dd" the sdb (OS) from the physical server to my second disk on the VM ? And after that, change to bootable my second virtual disk ?

Thanks
 
Old 07-31-2014, 10:18 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Yes. You probably now have 2 files for the VM representing disks - replace them with the 2 copies taken from your first server and remake the VM (after adjusting for changes to IP addresses etc).

example dd commands: http://www.pantz.org/software/dd/dri...hsshanddd.html
 
Old 07-31-2014, 10:56 AM   #3
wtb
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Ok. So I don't need to create first in the virtual disk the same partitions as my physical disk ?

My virtual disk is seen in my VM like a "normal" disk (/dev/vdb).
 
Old 07-31-2014, 11:11 AM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
If I understand correctly, then you will want to follow this process
  • Boot both servers with a boot CD
  • Make sure you have network connectivity (same switch or direct connect would be ideal)
  • Make sure you understand that the drive mappings have to stay the same. ie, old sda must go to new sda. old sdb must go to new sdb.
  • Understand that this process will overwrite anything in the VM. You are copying DRIVES,.. that means UUID's, partitions, MBRs.. ALL OF IT.

Code:
#On the new VM, start a listener:
  nc -l 8888|bzip2 -d|dd bs=16M of=/dev/sda
Code:
#On the old computer start a sender:
  dd bs=16M if=/dev/sda|bzip2 -c|nc VM.SERVER.IP 8888
Do that for each drive (sda, sdb, sdc and so on)

At the end of this, you will have copied each drive from the old server to the new VM. Essentially CLONING it from old to new.

You will have to make minor config changes,.. such as the IP address if you are using static IP's, and the mac address if it is statically set. Also, there might be some VM configuration you will have to change, such as Network Adapters and number of CPU's.

Last edited by szboardstretcher; 07-31-2014 at 11:13 AM.
 
1 members found this post helpful.
Old 07-31-2014, 03:31 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
You could clone the drive to drive by some means and then run a vm that uses the physical disk. Vm would be on the primary drive and never use the secondary drive for the vm.

In any clone you have to understand that some changes may need to be made either before or after. Grub and fstab issues may have devices loading or not loading.

What I've done before (with room) is to use something to clone data off primary to a single file image. Then boot vm and use shared source to place image on vm.

You can also do a rsync but you have to be careful to use live booted media. You can't easily clone off a running system. You could rsync most of the data and then fix stuff.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Have copy of installation disk(cracked disk) on linux computer need to transfer to EDDY1 Linux - Newbie 32 12-17-2010 03:06 PM
[SOLVED] disk to disk copy fedora 12 rmknox Linux - Newbie 2 08-17-2010 09:21 PM
Copy of IBM Server hard disk data to Another USB External Hard disk mazharcdn Linux - Server 2 09-02-2009 12:41 AM
System collapse without kernel panic when copy file to a sata-disk or usb-disk JammyWei Linux - Embedded & Single-board computer 0 12-25-2008 08:21 PM
copy linux installation from old disk to new disk rmanocha Linux - Software 4 07-20-2004 06:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration