Some days ago I received a 256GB SSD for my Server in which I used a normal 500GB HDD for Windows installation – booting process needed about 5 minutes so it was time for this step ;) Because many services, like Active Directory, Oracle Database or Atlassian Stash, running on this machine I did not want to reinstall and reconfigure everything from scratch, so I looked for tools and easy possibilities to clone/migrate my server installation. And here is my solution which worked really well and is totally free!
Starting point: HDD with 500GB, 3 partitions:
- 1: 100MB, system-reserved
- 2: 150GB, Windows installation
- 3: ~310GB, data partition
The plan was that I clone only the first two partitions because I do not need the third on my system partion any more. First I tried Clonezilla but I could not get the system boot from SSD. I created two partitions on the SSD with gparted (via Knoppix, msdos partition table), marked the first as boot partition and copied all data with Clonezilla (partition to partition mode). When I tried to boot from SSD the only thing I could see was a cursor blinking in the left top corner of the screen. The same thing happened when using Norton Ghost and EaseUS Todo Backup 7.0.
The next step I tried was using dd command. Here the short version: I copied the MBR from HDD to SSD. Because MBR on the SSD was wrong (because of the size differences), I removed the third partition from SSD via fdisk. After that I made a copy of the two partitions and it worked for me :)
Before you do any step described in the following CREATE A BACKUP!!! Next, check that you have working backup! Everything you do is done at your own risk! I’m not responsible for any problems or data loss! Make sure that you know what you are doing! And plan your steps, everything depends on how much space each disk has and what conditions you have. If you have any questions, ask! Good luck ;)
Boot Knoppix (or any other live Linux you prefer) via CD or USB stick. You can connect your HDD and SSD before booting, but make sure you start Knoppix.
Important: In the following HDD is
sda and SSD is
Make sure you have a msdos partition table on the SSD (
sdb). In my case, I used gparted (start menu -> settings) and created a new partition table. You can find this function in the menu under device.
Open a terminal and copy the MBR from HDD (
sda) to SSD (
sdb) – perhaps you have to be root for this action.
After executing this command you have exactly the same partition table on your SSD, but we need to adjust them!
dd if=/dev/sda of=/dev/sdb bs=512 count=1
To modify the parition table I used fdisk. Select the SSD:
p let you show the partitions – have a look at it before you go further. Enter
d for deleting a partition. In m case I had to enter
3 for the third partition.
To save the changes enter
w and after pressing ENTER fdisk writes the changes and quits. Now reboot, so the new partition table is loaded.
After booting open a terminal so we can start copying data!
# Copy first partition dd if=/dev/sda1 of=/dev/sdb1 bs=4096 conv=notrunc,noerror,sync # Copy the second partition dd if=/dev/sda2 of=/dev/sdb2 bs=4096 conv=notrunc,noerror,sync # When you want to see the copy progress, use pv; perhaps you have # to install it via sudo apt-get install pv dd if=/dev/sda1 | pv | of=/dev/sdb1 bs=4096 conv=notrunc,noerror,sync dd if=/dev/sda2 | pv | of=/dev/sdb2 bs=4096 conv=notrunc,noerror,sync
Open gparted and select SSD (
sdb). Now assign the boot flag to the first partition (
/dev/sdb1, 100MB partition): Partition -> Manage flags. If the boot flag is already set, do not modify anything!
I hope this helps you! Probably you have to adjust ist, but I think that’s not too difficult. I only tested it with my Windows Server 2008 installation, but I thin it should work with any other systems like Windows 7, 8, Server 2008/2012 etc. If there is something unclear and you have questions about this, ask me!
4 replies on “Clone/migrate Microsoft Windows from HDD to SSD – with Knoppix and dd command”
What about partition alignment? Plainly dding your plattered HDD to SSD will not properly align partitions which will, most likely, result in poor(er) SSD performance and increased SSD wear.
Yes, I think you are right with that! I can’t tell you how much difference there is between a normal installation on a SSD or dding the data from HDD to SSD.
But in my case I think it’s okay to use that technic because else I would have to waste a lot of time to reconfigure the server. In most other cases it would make more sense to install the OS from scratch, so it’s a clean installation.
Thanks for you comment!
Why don’t you need a second dd after pv pipe output?
dd if=/dev/sda1 | pv | dd of=/dev/sdb1 bs=4096 conv=notrunc,noerror,sync
Looks like a typo to me :)
I think you are right! I adjusted my blog post — Thanks!