Moving windows to the second (SSD) drive
Apart from a Macbook I also own a private windows laptop. It is a rather old machine (more than three years), so it is becoming a little slow compared to modern hardware. Time for a SSD with more space than the packed 320Gb normal disk. To fully enjoy the new SSD the whole windows installation needs to be moved to that disk. This is by no means an easy task under windows, it somehow is designed to not support this option. So what to do?
Goal:
- Having two disks in the machine. I didn’t pay attention to the size of the SSD, so it won’t fit in the place the current hard disk is. So I had to install it in a bay, might as well keep the original hard disk for backup purposes.
- Moving the installation from the original disk to the larger SSD.
- Making everything work again
Tools:
- Driveimage-xml
- EasyBCD
- A little bit of regedit
- One dos command
- Patience
Before we start please note the following:
This should go without saying, but hey you never know: these instructions, are presented as-is and might contain errors. I did my best, but I am human as well. Since we are playing with the MBR and the CBD here and we are moving data to new disks, there is a chance that you destroy all your data (I am not kidding here). Have a backup and don’t say I didn’t warn you. I am not responsible if your data is lost, your machine burns or anything bad happens. If you can’t handle that, stop here.
First thing to do is to copy the original drive with driveimage-xml in raw mode. Start driveimage-xml and select the original disk (C:) as the source and the new SSD (drive D: on my installation) as the target. Make sure it is a raw copy and wait for a couple of hours. On my installation I had to wait six hours to get the copy done. After those six hours I rebooted the machine, so all partition tables were read.
Although the copy is a complete copy of the original disk, you can not boot from the new disk. Windows bootloader will give you an error. The reason for the error is that the windows bootchain is not setup correctly. To fix that one can either use BCDedit, which is part of windows, or use the easier alternative EasyBCD.
In easybcd add a new entry called “Microsoft Windows 7 – SSD” and pointed that to the D: drive.
After that, click “Advanced Settings” and rename the old installation to “Microsoft Windows 7 – old”, just for ease of navigation. The result will look like this:
Although the settings are now on the original disk, you also might want to have them on the new disk. Since we haven’t changed the boot order in the bios the machine will currently load the MBR from the original disk, present us with a menu of options and then continue the boot from the SSD. It would be quicker and in general nicer to change the bootorder to the second disk.
For this to work an MBR and BCD need to be installed on the second disk. Luckily this can be done with EasyBCD as well. Just click “BCD Deployment” and deploy the BCD to the second disk. Select your new drive from the drop down and click “Install BCD”.
Now this new BCD will probably be empty, so you need to add two new entries again. One called “Microsoft Windows 7 – old”, which points to your current C: drive and one to “Microsoft Windows 7 – SSD”, which points to the new drive.
What we have right now is the following:
- Windows can boot from any of the two disks
- The old drive is still drive C:, the new drive is still drive D:
Swapping the drive letters
If you would boot from the new drive now, chances are everything will be alright, but most of the data will still be loaded from the old drive. Windows “knows” everything is installed on drive C: (your old drive), so all applications and your user files will be loaded from the old drive. Not what we want, so we need to change the drive letters. Now, this cannot be done with device manager, you actually have to use regedit to do this.
Microsoft has a nice knowledge base article where they describe the whole process. On my installation I did not have to change the user rights, so the only steps I needed to execute were:
- Open regedit
- Browse to HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
- Change “\DosDevices\C:” to “\DosDevices\Z:”
- Change “\DosDevices\D:” to “\DosDevices\C:”
- Change “\DosDevices\Z:” to “\DosDevices\D:”
However you might want to execute all steps in the knowledge base article. Please pay special notice to the use of regedit and regedt32, since both are used for different purposes in the article.
That’s it. The drive is now cloned, the MBR and BCD changed and the new drive is now C:. Time for a reboot and keep your fingers crossed!
Resizing the filesystem
Although I moved to a larger disk, explorer only reported the old disk size. I was not able to use the extra GB I paid for. The reason for this is that we’ve made and exact copy of the original system. The filesystem on my disk was not yet aware of the extra space. To extend the filesystem do the following:
- Start a command prompt in Administrator mode (type cmd in the start-menu search box and right click on the found application, select “Run as Administrator” and then enter your password)
- enter “diskpart”, without the quotes and press enter
- Now in diskpart type “LIST VOLUME”, again without quotes and press enter
- You will now see a list with the volumes attached to your installation. Please find your new SSD in the list (it will probably be the last one)
- Now type “SELECT [YOUR_VOLUME_NAME]”, again without quotes replacing [YOUR_VOLUME_NAME] with the volume name you have found in the previous step.
- Last but not least type the following to extend your filesystem to the maximum size allowed on the disk (again no quotes): “EXTEND FILESYSTEM”
- Quit diskpart with the “EXIT” command
On my laptop that’s it. I now have a really fast machin that can live another three years again.
You could now format your old drive (drive D:) and use it for whatever you want. You could also use EasyBCD to tweak the boot setting, so there is only one menu option available and you don’t have to wait for a selection during boot anymore. I leave it to you to figure out how to do that, though.