Cygwin: clone disk with dd

root's picture

Remember this article?

Linux is powerful and whatever linux based, is powerful too.
Cygwin can help you in many ways and in this article I will explain how easy is to clone an entire disk with it.
Proprietary and costly applications? HA! :)

!!! WARNING !!!
!!! WARNING !!!

So, if you are sure YOU CAN DO THIS, follow up.
In this article, we will attempt to clone the disk where Windows is installed (that holds C:\).

0. Start cygwin as administrator

Right click on Cygwin icon and choose Run as administrator.

1. You need first to know source and target disks

For that, you can use the contents of /proc/partitions which will show you on which disk we have C:\ (our source) and where E:\ is (our target).

10:29:38 root@GAMEBOX:~$ cat /proc/partitions
major minor  #blocks  name   win-mounts

    8     0 976762584 sda
    8     1     16367 sda1
    8     2 976745472 sda2
    8    16 976762584 sdb
    8    17     16367 sdb1
    8    18 976745472 sdb2
    8    32 117220824 sdc
    8    33    512000 sdc1  
    8    34 155776000 sdc2   C:\
    8    48 975175680 sdd
    8    49    131072 sdd1
    8    50 975043564 sdd2   D:\
    8    64 117227520 sde
    8    65 117224448 sde1   E:\

We will not choose only the C:\ partition but the entire disk, to have a bootable backup copy of the existing Windows installation.
So, the source in our example will be /dev/sdc and destination /dev/sde. Do not worry that E:\ is still mounted. There will be no error and the disk will be overwritten.

2. Run dd with source and destination

Command to execute: dd if=/dev/sdc of=/dev/sde bs=4096 conv=sync,noerror
NOTE: this command can take quite a time so be patient. The output will be shown only at the end so leave it like this and do not panic if you do not see anything for now.

After a while (even more than one hour), the execution will be completed and similar output will be shown:

10:31:45 root@GAMEBOX:~$ dd if=/dev/sdc of=/dev/sde bs=4096 conv=sync,noerror
29305206+0 records in
29305206+0 records out
120034123776 bytes (120 GB, 112 GiB) copied, 27350.1 s, 4.4 MB/s

Now, the current windows won't recognise the disk because it is in conflict with the existing one (signature collision).
You can either temporary replace the disk with the backup and see if it boots correctly and the data is OK or mount it on another system.
I did tested mine in a virtualbox instance and it was successful. The only side effect was, because the dd copied an online disk, there were some errors on C:\ that the windows had to fix.


Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.