[CentOS] How to copy a system?

Thu May 5 14:41:04 UTC 2011
Robert Heller <heller at deepsoft.com>

At Thu, 05 May 2011 10:10:52 -0400 CentOS mailing list <centos at centos.org> wrote:

> 
> On 05/05/2011 08:01 AM Brunner, Brian T. wrote:
> > centos-bounces at centos.org wrote:
> >> At Thu, 05 May 2011 07:44:52 -0400 CentOS mailing list
> >> <centos at centos.org> wrote: 
> >>
> >>>
> >>> On 05/05/2011 07:13 AM, Timothy Murphy wrote:
> >>>> Is there a standard way of copying a working system
> >>>> from one machine to another with different partitions?
> >>> You could also utilize cloning software, such as the client version
> >>> of drbl, clonezilla livecd. 
> >>>
> >>> You could also do a direct copy with dd onto a connected drive.
> >> Warning: dd is not a good choise if the source and desination
> >> drives/partitions are *different* sizes.
> > 
> > Different block mappings will also give you grief.
> > .:. The drives must be identical manufacturer and model, down to the
> > firmware revision.
> > dd is not a backup tool in the general sense.
> 
> I had doubts about dd also.  But last year, when I needed to upgrade to
> a larger drive, I used it and it worked fine.  I bought a new drive (of
> course of larger size... different manufacturer too), put it into a
> drive enclosure, plugged that new drive into my USB port, and ran dd to
> copy the entirety of hda to hdb.  Shutting down the machine, I swapped
> the hard drives and booted with the new drive and-- viola!-- new bigger
> drive with everything running just like on the old drive.  I didn't have
> to reconfigure anything; even the networking worked on the new drive
> without touching anything.  The only thing I did on the new drive was to
> create a new partition from all the extra new hd space I had.  Indeed,
> this is a multi-boot machine and all OSs on it copied over just fine.
> In addition, all my linux partitions are encrypted, and all that copied
> over perfectly as well.
> 
> One tip: Use dd's smallest block size (BS).  I did this copy using dd
> several times, starting with 4k, then 2k block sizes and the new disk
> had problems when I tried to use it.  IIRC, I had to rachet down to 256
> to get a working drive.  And this took eight or ten hours to copy an 80G
> drive.

Hmmm.... Using dump & restore (or tar or rsync or cpio, etc.) would
likely be a lot faster.  Esp. if the disk is not 100% full.  Remember,
dd will copy even the unused free blocks (which is a total waste of
time).  And dump & restore will likely use a more optimal block size,
which will copy the data faster as well...

> 
> Another tip: in your BIOS the parameter for the hard drive should
> probably be Auto-Detect if your source and destination drives aren't
> identical.  That's generally the default anyway.
> 
> Final tip (I think):  For me, my machine A and machine B were the same
> machine... so of course the hardware was absolutely identical.  Using dd
> might not work if the hardware on A and B are too different from one
> another.
> 
> 
> hth,
> ken
> 
> 

-- 
Robert Heller             -- 978-544-6933 / heller at deepsoft.com
Deepwoods Software        -- http://www.deepsoft.com/
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments