• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 675
  • Last Modified:

cloning drive by dd to bigger distination

Hi
I have a project running and i will have to clone few server running on Vm  and have to put those clone in each individual server.

i am using DD so i want to use this DD as it works .

i have used Same hard drive like

10 GB from Source to Distination.

works like charm .

but problem is : in real server the source harddrive is 64 GB , and the hardware server is 80GB

as you can see that Destination Harddrive is bigger then source

Now i dont understand if i do DD from source to destination

will it work ?? if it works what will happen to rest 18GB ?

I was teling this , from 8GB source with 40 GB destination.. the DD command is running from last 4 hr..
which put me in doubt

so , would you be able to tell that , will it work ??
Please tell me from your experiences ..
0
fosiul01
Asked:
fosiul01
  • 7
  • 3
  • 3
  • +1
8 Solutions
 
arnoldCommented:
DD is a rather one for one copy and will take a long time since it is copying at the block/media level.

You are better off using dump | restore mechanism

This will provide you with the opportunity to resize the partitions on the new drive
Lets say /dev/sda is the current 64GB drive and the newly attached drive is /dev/sdb.
You partition /dev/sdb as you need and then copy a partition at a time following the example below:
dump -level0 -f - /dev/sda1 | restore -xf -  /dev/sdb1

The above takes a full backup of the /dev/sda1 partition and outputs it on STDOUT as a data stream, where restore takes the data stream on stdin and expands/writes the data into /dev/sdb1

This process will also likely be faster since it will only look at store the actual files not empty space, the only issue you have to make sure to install the boot image on the replacement drive. i.e. if the new drive in and does not booth, you would need to run the install boot/lilo

Clonezilla, etc. could also be used.
0
 
fosiul01Author Commented:
Boss glad to see u!!
 I need serious help

i have few Virtual Server running on VMWARe, and each of them has 64Gb hardirve

and the partitiion is like this
bellow is same thing but i am using 8GB of hardirive to clone .


Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a8b35

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1             900        1044     1164712+  82  Linux swap / Solaris
/dev/sda2   *           1         899     7221186   83  Linux

Partition table entries are not in disk order



now, the destination hardirve is : 40GB in this case  ( i am trying this at home) and monday at office i will ahve to do this live ..

so if i use dd command from 8GB to 40GB will it work ??

(a)so what will happen to rest 32 GB hardive  ???



now , i have another idea

if i use live cd in Destination server and create same partition like

dev/sda1             900        1044     1164712+  82  Linux swap / Solaris
/dev/sda2   *           1         899     7221186   83  Linux


now if i use dd for each partition

eample

dd if=/dev/sda1 | nc 192.168.0.12 1234
and
dd if=/dev/sda2 | nc 192.168.0.12 1234


now if  I reboot the distination server, will it boot  with same OS of source server ??



0
 
arnoldCommented:
DD is a block level media copy (block by block /sector by sector) will take a long time. (patience is required)

There is no significant improvement in copying by hand a book or breaking the book into chapters and copying each chapter by hand unless you have helpers.:)
You can not separate the partition from the drive to hook into another system. So parallel copy is not an option.

If you are doing a remote backup/restore dump is the best way,
if you want to run the restore remotely you would
dump -level0 -f - <partition> | ssh user@remote 'restore -xf - <partition>
if you are on the system where the restore is to happen,
ssh user@remote 'dump -level0 -f - <partition_to_backup>' | restore -xf - <partition>

the boot block configuration is the item you have to remeber to do, if you use lilo, I think there is a command that tells lilo to install/configure the boot record in the MBR similar with grub (not sure which freebsd uses).
What type of access do you have on the remote system? IP based KVM? or do you have to ssh into it?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
fosiul01Author Commented:
its debain server


the boot block configuration is the item you have to remeber to do

yes thsi is the problem..
so you saying..
if i dd /sda1 and sda2 seperatly , the Remote mechine will not boot due to grub  (MBR) problem ?

in that case do i have to create mbr  manually again ??


currnetly i am thining of DD as i know its working..
so i need to work with DD ..  

the end job is :

i need to shutdown the VM server and clone all the VM mechine to individual hardware server.


or just dd from Source server (SDA) to Destination server (SDA)

will it work ??  ( pls be awre , source is 8GB and destination is 40 GB)

i am doing this currently but its almost 6 hr the dd still running, let see

but what you think ?
0
 
gheistCommented:
You need to use blocksize in dd
dd if.... of.... bs=32k
could be more if NCQ is in use.
0
 
fosiul01Author Commented:
what is ncq ?
But larger destination disk .. Will it create any issue?
0
 
arnoldCommented:
Ok, so limiting to DD, I do not think you can use dd to clone and resize the destination parition.
copying an 8GB partition to a 40GB will leave an 8GB partition and an unallocated 32GB space on the 40GB drive.

If you already created the boot and you are not doing a disk copy, you should be fine, but
If you are going from VM to real system, I think I saw a question recently (within a few days that dealt with transitioning a VM into a physical setup.)


A while back people were traveling using a horse and carriage.  See if the dump| restore works better for your tests.
0
 
fosiul01Author Commented:
ok so u saying with dd it will not work...

But what u meant by boot and doing a disk copy?

I have nt done any boot or disk copy..
0
 
wesly_chenCommented:
I recommend Clonezilla, which I use most of time for Linux cloning.
http://clonezilla.org/

> have to clone few server running on Vm
However, for VM, can you just copy the VM disk files over?
0
 
fosiul01Author Commented:
even though i use clonezilla still proble..

Because original server is 64 gb and destination server is 80gb

im moving individual vm into dedicated server. So copy vmdk would work
0
 
fosiul01Author Commented:
if i use dump and restore  

how will it work  with

8gb source and 40 gb destinatiom

im trying to clone whole os (whole system)
0
 
wesly_chenCommented:
Clonezilla only do used blocks in harddisk are saved and restored. It is faster.
As for partion size, it needs to use some tools like Parted (http://www.gnu.org/software/parted/) to extend it.
However, you can just fdisk the extra disk space and mount as /tmp or /data for data storage.
0
 
fosiul01Author Commented:
DD worked!!

its took 6 hrs to clone 8GB hardrive on 40GB hardrive!!
its only because my poor wireless netwokr
its was copying data by 300Kb/S

hence its took long
but Destination pc is working properly as source pc

i can use fdisk /dev/sda if i want to use rest amount and mount it different partition..


0
 
gheistCommented:
default block size is 512 bytes
it takes the same time on PCI bus as 32k DMA copy.
0
 
wesly_chenCommented:
Try G4U with compression for the disk image, it will save a lot of time to transfer the image.
http://www.feyrer.de/g4u/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 7
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now