home
faq
how to
sitemap
contact
 
Some notes on how to clone a hard drive
 

October 2, 2017

 
   

Described below are some directions on cloning a bootable hard drive.

These directions worked for cloning a windows 7 boot drive to a blank hard drive.

The software tools required for this operation are:

   Parted Magic 8.1   (bootable)   (from 2013, this is a version of linux)

   Bart's P.E.   (bootable)   (a version of windows XP)

 

For this example we used the following hard drives:

   the source drive:   30 Gb   hard drive containing windows 7

   the target drive:   120 Gb    blank SSD

 

First wipe, and format the target drive using Parted Magic (linux):

          - with the PC turned off, attach the target drive.

          - boot up using the Parted Magic bootable CD

          - use the partition tool within Parted Magic to wipe the target drive, and format to: ntfs

          - turn off the PC

Then attach the source drive and reboot into Parted Magic (linux). The PC should now have these attached as hard drives:

  the source drive: 30 Gb   (hard drive containing windows 7)  /dev/sdb1
  the target drive: 120 Gb    (blank SSD)   /dev/sda1

Leave the drives unmounted.

Use: Parted Magic Mount to make sure that the drives are unmounted.

To clone the drives and copy the contents from the source drive to the target drive
open an xterm and use the dd (convert and copy a file) command:

      > dd if=/dev/sdb1 of=/dev/sda1 bs=4096 conv=sync,noerror   &

where:

    if=/dev/sdb1    refers to the source drive, the data to be copied from.
                                if=FILE   read from FILE instead of stdin

    of=/dev/sda1    refers to the target drive where data is to be written.
                                of=FILE   write to FILE instead of stdout

    bs=4096   ... or ... bs=BYTES, read and write up to BYTES bytes at a time (default: 512),
                       overrides ibs and obs

    conv=sync,noerror    ... convert the file, and make sure it doesn't stop if it encounters any errors,
                         and fills the missing sector or sectors with null bytes

         The dd command refers to the DD statement found in IBM's Job Control Language (JCL),
         in which the initials stand for "Data Definition".

         Accidentally reversing the input and output drives, that is, mistakenly setting the "if=" drive as the target,
         and the "of=" drive as the source will invariably destory all of the data on the wrong hard drive.
         The dd command has also been referred to as the disk destroyer.

Open a second xterm and find the process ID of the dd command (use top):

If, for example the PID of dd is:

dd pid = 4655

then issue the following command to the first xterm (the one running dd) to get output feedback from the dd command within the xterm:

      > watch -n 10 kill -USR1 4655

The above will output the progress of the dd command every 10 seconds.

------------------------

After the cloning procedure, the new hard drive will still need to have its master boot record fixed, the drive marked as bootable and its partition adjusted.

Continuing, turn off the PC, remove the old source drive (30 Gb, hard drive containing windows 7) then attach the cloned target drive (120 Gb, formerly blank hard drive now containing windows 7) as though it were to be the boot drive.

Then boot up using Bart's P.E. windows XP cd.

Within Bart's PE we will fix the master boot record (mbr) of the new drive. From here we'll call it the new C: boot drive.

Use the mbr tools from here: mbrfix.zip

Within Bart's P.E. desktop:

          - open up A43 file management utility

          - unzip the files from the mbrfix.zip, then copy them over to the new C: boot drive,
             possibly from a USB stick, maybe to:

                C:\temp\mbrfix_files           Mbrfix.exe, and Mbrfix64.exe

          - from within the A43 file management utility open up a DOS box:

                >> tools >> OpenDOSwindow

          - from:    C:\temp\mbrfix_files    run:

                mbrfix  /drive  0  listpartitions

                mbrfix  /drive  0  fixmbr  /yes

                mbrfix  /drive  0  /partition  1  setactivepartition

Now we should see that the drive's Boot partition is set to YES:

                mbrfix  /drive  0  listpartitions

          - reboot

The new drive may fail to boot up:

          - try to fix this with the windows 7 boot up DVD.

          - then choose:   Repair your computer

------------------------

After cloning the drive and booting it up, ms' windows explorer may show a smaller size than what the drive actually should be. This can happen if the source drive is smaller than the target drive.

Use diskpart to extend the hard drive's space:

          - open a DOS box and run:

                > diskpart

          - then from within the diskpart program issue these command:

                > list volume          (get a list with volume #, use this # in the next command).
                > select volume #
                > extend filesystem

The above should extend the drive's hard drive space to use its full capacity.

 

  purple seperator  

 

 

dark maelstrom icon dark maelstrom
flash games
  t-shirt icon dark maelstrom
t-shirt designs

back

home