I want to copy a Windows 7 partition that came installed on my laptop to my desktop computer.

I've tried:

# bzip2 -c /dev/sda5 | nc 2222 # on laptop
# nc -l 2222 | bzip2 -d > /dev/sda1 # on desktop

But gparted tells me the partition is corrupted with a lot of error messages.

I also tried:

# dd if=/dev/sda1 | gzip -1 - | ssh user@hostname dd of=image.gz # on laptop
# dd if=image.gz | gunzip -1 - | dd of=/dev/sda5 # on desktop

It worked for a small partition (35 Mb), but didn't for larger ones (18Gb and 120Gb). The ssh pipe keeps breaking and one attempt that completed gave errors in gparted.

What would be a better way of copying the partitions?

  • 3
    What does "gpared tells me the partition is corrupted with a lot of error messages" mean? Be specific. Also you need to make sure that the destination partition is at least as large as the source. – psusi Dec 3 '12 at 16:33
  • 1
    dd, with netcat might give better speed? bzip2 is SLOW... ssh -C is easier to work with than a manual gzip... (at leas if you have dd directly writing to disk...) For the dd example, using cat > image.gz (via SSH) to write the file will reduce the number of layers... – Gert van den Berg Dec 4 '12 at 7:40

I finally copied using a tar pipe.

# cd /mnt/sda1/ && tar cf - * | nc 2222 # on laptop
# cd /mnt/sda5/ && nc -l 2222 | tar x # on desktop

Copying was way faster and seemed to work.

I wasn't able to boot in Windows 7 thought. I only saw a black screen when booting in it and the recovery partition freezes at Starting Windows.

I think that you need two licences to use Windows 7 on two computer so I don't think it would have worked.

  • 1
    Adding gzip/gunzip in fast-compression-mode in that pipe might help on low-bandwidth-connections. I would also have used "dd" with a block-level of at least 8K for reading (and for writing). – Nils Dec 5 '12 at 21:43

Tar is not the way to copy bootable partitions. You'll get only your files, but not the on-disk structure. If you want to clone a disk, you'd better use Clonezilla. Often the boot manager is on the master boot record so you'll need to copy it, and windows7 has a hidden primary partition (about 100MB) which may be also needed. I'd reccomend you to just install virtualbox, create an image of the disk & restore it inside the virtual machine with CloneZilla. Thus you''ll have your windows7 in your VM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.