" /> TechnicaLee Speaking: February 2011 Archives

« January 2011 | Main | March 2011 »

February 8, 2011

Moving to a new SSD

At work, we recently got new solid-state drives (SSD). I've been pretty happy with my current Windows 7 installation on my ThinkPad T61 laptop, so I wanted to move to the new drive by cloning the existing drive. One challenge here is that the old drive was a larger capacity than the new drive (320GB vs. 256GB). This post summarizes how I easily cloned my old drive to the SSD.

 

  1. Make sure that the total amount of used space on the old drive is less than the size of the new drive. Delete or move any large content necessary to get to this point.
  2. Use the Disk Management tool in the Windows 7 control panel (descriptive text is Create and format hard disk partitions) to shrink the primary partition of the old drive so that it is smaller than the new drive.
    • When you right-click on the partition and choose Shrink Volume, Windows will think for awhile and then tell you the maximum amount of space that can be removed. If this is not enough space, then you'll need to follow the following steps to identify the unmovable files that are preventing further shrinkage and remove them / make them movable.
    • The Windows Event Viewer records an event with type 259 that references the unmovable file that is preventing the partition from being shrunk further. When I went through this process, I ran into three types of files that blocked my progress:
      • The Windows pagefile.sys file. This is c:\pagefile.sys. You can remove the pagefile by turning off the page file in the Advanced system settings area of the System control panel. Click through to Advanced > Performance > Settings… > Advanced > Change… and choose No paging file. After you restart Windows, you'll be able to remove pagefile.sys.
      • The Windows hiberfil.sys file. This is c:\hiberfil.sys, and is used for system hibernation. Disable system hibernation in the Power Options control panel and then delete the hibernation file.
      • Windows Search index files. These files have a file extension of .wid. I was able to remove them after disabling the Windows Search service.
    • After removing / moving an unmovable file, repeat the attempt to shrink the partition until the partition can be shrunk to a size smaller than the new SSD's capacity.
  3. Connect the new SSD. I did this using a drive bay in place of my DVD drive. You could use an external USB enclosure as well, but the clone will be much slower.
  4. Create a bootable Linux CD or USB stick. I used a colleague's existing USB stick, but something like Knoppix would work just as well.
  5. Restart your machine and boot into Linux.
  6. Run fdisk –l to check which device is which drive. In my case, my old drive was /dev/sda and the SSD was /dev/sdb.
  7. Use dd to clone the old drive to the new drive: dd if=/dev/sda of=/dev/sdb bs=16M
    • Make sure that the if parameter points to the old drive and the of parameter to the new drive.
    • I used a block size of 16M but you could probably even go smaller.
    • Note that dd doesn't give any progress indication, at least not without jumping through any additional hoops.
    • At the end of the cloning, dd will give you an error because the new drive is out of space while the old drive is not yet finished. This is expected and not a problem given that the remaining space on the old drive is unallocated.
  8. Swap drives so that the SSD is the main laptop drive and boot the computer. In my case, Windows prompted me to restart once and then everything was all set to go.

Really easy to do. Let me know if you have any questions!