Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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