?
Solved

cloning drive by dd to bigger distination

Posted on 2011-05-07
15
Medium Priority
?
646 Views
Last Modified: 2013-11-22
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
Comment
Question by:fosiul01
  • 7
  • 3
  • 3
  • +1
15 Comments
 
LVL 81

Accepted Solution

by:
arnold earned 756 total points
ID: 35713147
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
 
LVL 29

Author Comment

by:fosiul01
ID: 35713174
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
 
LVL 81

Assisted Solution

by:arnold
arnold earned 756 total points
ID: 35713205
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Author Comment

by:fosiul01
ID: 35713224
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
 
LVL 62

Assisted Solution

by:gheist
gheist earned 500 total points
ID: 35713257
You need to use blocksize in dd
dd if.... of.... bs=32k
could be more if NCQ is in use.
0
 
LVL 29

Author Comment

by:fosiul01
ID: 35713269
what is ncq ?
But larger destination disk .. Will it create any issue?
0
 
LVL 81

Assisted Solution

by:arnold
arnold earned 756 total points
ID: 35713274
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
 
LVL 29

Author Comment

by:fosiul01
ID: 35713315
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
 
LVL 38

Assisted Solution

by:wesly_chen
wesly_chen earned 744 total points
ID: 35713333
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
 
LVL 29

Author Comment

by:fosiul01
ID: 35713352
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
 
LVL 29

Author Comment

by:fosiul01
ID: 35713356
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
 
LVL 38

Assisted Solution

by:wesly_chen
wesly_chen earned 744 total points
ID: 35713403
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
 
LVL 29

Author Comment

by:fosiul01
ID: 35713559
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
 
LVL 62

Assisted Solution

by:gheist
gheist earned 500 total points
ID: 35713601
default block size is 512 bytes
it takes the same time on PCI bus as 32k DMA copy.
0
 
LVL 38

Assisted Solution

by:wesly_chen
wesly_chen earned 744 total points
ID: 35713865
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month17 days, 13 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question