Clone-HDD-to-SSD
September 17, 2012 Leave a comment
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.
- Full backup of Windows 7 system to an eSATA drive [or USB, preferably USB3]
- Did you do step #1? Just checking.
- Download and burn a 32-bit Ubuntu Live CD from ISO image here http://www.ubuntu.com/download/desktop
- 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)
- Power off machine
- Insert SSD drive in tray (they tray having already purchased for about $10) and then into the expansion bay in docking station
- Boot In Windows 7
- Create an NTFS partition on the SSD
- On the HDD, do a “Defrag Monthly” and “Consolidate Free Space” using http://www.mydefrag.com/
- 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)
- Reboot into a 32-bit Ubuntu Live CD
- Start gparted (graphical partition editor)
- Check the size of the NTFS partition on the SSD – in my case
- Use the pull down to select the SSD (in my case /dev/sdb)
- 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.]
- Re-size the partition on the HDD to match the size of the target SSD.
- (may not have needed to do this – see note below)
- Add a “boot” flag to the SSD
- Easy to do with gparted – right click on the partition and adding flags is one of the options.
- Reboot into Windows 7 – to allow disk to check itself (similar screenshots can be found here http://gparted.sourceforge.net/larry/resize/resizing.htm )
- 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.
- 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]
- Copy the MBR from HDD to SSD
- 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)
- 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
- Use nftsclone to copy the partition
- 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)
- 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.)
- Following laptop maintenance manual instructions
- Prepare light, preferably not a candle, and screwdriver, and mix up a little bit of patience
- Pull main HDD out of laptop & remove from caddy
- Put SSD in caddy and replace in laptop
- Power-on
- 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.