Direct Copying

If you have an existing system drive and you'd like to make a direct copy to a new drive, you can use dd. For example:

     dd if=/dev/hdc of=/dev/hdb bs=64M

This can be used to copy a small drive to a larger drive with identical partitioning as the small drive plus free (unused) space. Once this is done, you can add a new partition to take advantage of increased drive space.

Note that for a typical 1TB drive, dd can take two or three hours to copy. If you'd like a faster alternative, get a copy of sg_dd from:

     http://www.torque.net/sg/#Utilities:%20sg_utils%20and%20sg3_utils

and install the following script (already installed as copydisks):

     #!/bin/bash
     #
     # Copy two disks, from /dev/hdc (master) to /dev/hdb (slave), using raw mode
     # for fast copying.  The "rev" option can be used to copy from /dev/hdb to
     # /dev/hdc.
     #
     # Used to ensure accurate copying and no screw-ups from typos, etc.  Be
     # warned that whatever disk is mounted on /dev/hdb is gone so exercise
     # caution.
     #
     SourceHD=/dev/hdc
     DestHD=/dev/hdb
     if test x"$1" == xrev; then
         echo Reversed!  Copying from /dev/hdb to /dev/hdc!
         SourceHD=/dev/hdb
         DestHD=/dev/hdc
     fi
     Sectors=`/sbin/fdisk -lu $SourceHD 2>&1 | grep total \
         | sed -r "s/^.+?total ([0-9]+) sectors$/\1/"`
     /usr/bin/raw /dev/raw/raw1 $SourceHD
     /usr/bin/raw /dev/raw/raw2 $DestHD
     /sbin/fdisk -lu $SourceHD 2>&1
     /sbin/fdisk -lu $DestHD 2>&1
     echo
     echo Will copy $Sectors sectors from $SourceHD to $DestHD
     read -p "Is this OK? [n|y] " PromptResp
     if test x"$PromptResp" != xy; then
         echo Responded \"$PromptResp\", exiting!
         exit 1
     fi
     echo
     echo Starting copy:
     echo /usr/local/bin/sg_dd bs=512 bpt=16384 count=$Sectors time=1 \
         if=/dev/raw/raw1 of=/dev/raw/raw2
     /usr/local/bin/sg_dd bs=512 bpt=16384 count=$Sectors time=1 \
         if=/dev/raw/raw1 of=/dev/raw/raw2