Clone-HDD-to-SSD

Being the proud new owner of an OCZ Vertex 4 SSD (256GB), I thought I’d go about cloning my OS image over to it from my 500GB HDD.  Thankfully I hadn’t filled up my HDD with various and sundry files that I’d never cleanup unless forced to by my Jedi Master, which made things easier.

How will it go? I wondered myself, and was hopeful.

Here’s how it went, with one skipped heartbeat. For explanation of anything italics, see my note at the end.

  1. Full backup of Windows 7 system to an eSATA drive [or USB, preferably USB3]
  2. Did you do step #1?  Just checking.
  3. Download and burn a 32-bit Ubuntu Live CD from ISO image here http://www.ubuntu.com/download/desktop
    1. Could potentially have used a bootable USB stick too, if you don’t have a 3rd media bay (to have 2 hard drives and a CD/DVD drive)
  4. Power off machine
  5. Insert SSD drive in tray (they tray having already purchased for about $10) and then into the expansion bay in docking station
  6. Boot In Windows 7
  7. Create an NTFS partition on the SSD
  8. On the HDD, do a “Defrag Monthly” and “Consolidate Free Space” using http://www.mydefrag.com/
    1. I wanted to make sure all the data was as close to the front of the partition as possible, allowing me to more easily re-size it. (may not have needed to do this – more below)
  9. Reboot into a 32-bit Ubuntu Live CD
  10. Start gparted (graphical partition editor)
  11. Check the size of the NTFS partition on the SSD – in my case
    1. Use the pull down to select the SSD (in my case /dev/sdb)
    2. In my case it was 244196MB [there was 1.34MB left free, but I wanted to stay with the partition that Windows had created, and not change it, so I left it.]
  12. Re-size the partition on the HDD to match the size of the target SSD.
    1. (may not have needed to do this – see note below)
  13. Add a “boot” flag to the SSD
    1. Easy to do with gparted – right click on the partition and adding flags is one of the options.
  14. Reboot into Windows 7 – to allow disk to check itself (similar screenshots can be found here http://gparted.sourceforge.net/larry/resize/resizing.htm )
    1. Instead of the I got a blue screen… and temporarily panicked. However, as I’ve been coached, trained, and mentored, when there is a problem, especially corruption, DON’T PANIC… thanks to Douglas Adams, Paul Randal, and Gail Shaw, to name a few.
    2. I actually had to do a repair here, for some reason, booting into repair console ( the screenshots linked above did not show for me).  Thankfully I had the full backup if I would have needed it [see Steps #1 and #2]
  15. Copy the MBR from HDD to SSD
    1. Since I already set the partitions, I didn’t want to over-write the partition table, so just want the first 446 bytes (if I wanted the partition table too, I’d have copied first 512 bytes)
    2. Use this dd command, where if (input file) is the HDD – dev/sda – and of (output file) is /dev/sdb – the SSD.

           sudo dd if=/dev/sda of=/dev/sdb bs=446 count=1

  16. Use nftsclone to copy the partition
    1. WARNING: be sure you get the order of parameters right here [or you’ll need the backup you made in step #1… you did make one, right?]. Best to look at the manual page for ntfsclone. (aside, regarding parameter order, I had a bad flashback to copying files in CP/M… rusty dusty memories)
    2. Overwrite the contents of /dev/sdb1 (first partition on disk 2 – SSD) with /dev/sda1 (first partition on disk 1 – HDD).

             sudo ntfsclone –overwrite /dev/sdb1 /dev/sda1                

                (Wait patiently… took about 25 minutes.)

  1. Following laptop maintenance manual instructions
    1. Prepare light, preferably not a candle, and screwdriver, and mix up a little bit of patience
    2. Pull main HDD out of laptop & remove from caddy
    3. Put SSD in caddy and replace in laptop
  2. Power-on
  3. Success!

Note: I think I wouldn’t have had to bothered with defragmenting or re-sizing the partition on the 500GB drive when using ntfsclone – I believe it will handle the differences and fragmentation. I know if I had solely used the dd utility I would have had to. Next time I do something like this, I’ll use dd for the boot sector only, and then try ntfsclone – which would correspond roughly to following all the lines above that are in italics (though I wonder if this will setup the partition table correctly… will post if/when I do it again!)

S.D.G.