1

I want to duplicate a hard drive from one Windows 7 x64 laptop to another with identical hardware but a slightly smaller hard-drive. Normally I'd use ghost4unix or similar to clone C: and ignore D: (a second partition with nothing important on it) but the drive on the first laptop is secured with Trucrypt full-disk encryption.

If I was moving to an identically sized drive I'd just dd the entire drive, block by block, but that won't work in this case. What is the best way to duplicate the system in this case?

DrStalker
  • 6,676
  • 24
  • 76
  • 106

1 Answers1

3

The only solution I can come up with so far requires a third drive for an intermediate copy. If anyone can think of something simpler, feel free to chime in.

I found a reference on the Ubuntu forums that sounds promising. It looks like you should be able to mount the TrueCrypt volume as a loopback device without mounting the filesystem:

truecrypt --filesystem=none /dev/sdx#

where /dev/sdx is the drive, and # is the partition. Then list your TrueCrypt volumes with this command:

truecrypt -l

It will open a window that lists an entry like this:

1: /dev/sdx# /dev/loop0 -

Now you should be able to dd from /dev/loop0 (or whatever loop device was listed) to another (intermediate) hard drive of equal or greater size.

Once the partition is copied to the intermediate hard drive, you should be able to use a cloning tool that can safely shrink NTFS partitions (Ghost, Acronis TrueImage, etc.) to clone it onto the smaller laptop hard drive. (Unfortunately, the ghost4linux documentation didn't sound very promising in this respect, so you might need to do a couple more things before copying--read on...)

If you don't have a disk imaging program that supports safe resizing during imaging, you can use ntfsresize to first safely shrink your partition on the intermediate drive.

First, confirm whether the partition can theoretically be shrunken to the size you need:

ntfsresize --info /dev/sdy#

where sdy# is the newly-copied partition on the intermediate drive.

If the smallest possible size is smaller than or equal to the size of your other (smaller) laptop hard drive, you can test resizing the partition:

ntfsresize --no-action --size ##G /dev/sdy#

where ## is the size in gigabytes (for clarity, 10^9) less than or equal to your smaller laptop drive. If this works okay, you can continue with the resize (this time for real):

ntfsresize --size ##G /dev/sdy#

and finally, copy the partition from the intermediate drive to your smaller laptop hard drive using ghost4linux or some other cloning software.

rob
  • 1,253
  • 1
  • 10
  • 17