Re: Cloning a disk using dd



On Fri, 02 Nov 2007 09:55:28 -0600, Douglas Mayne wrote:

On Thu, 01 Nov 2007 17:30:12 +0000, General Schvantzkoph wrote:

On Thu, 01 Nov 2007 08:27:28 -0600, Douglas Mayne wrote:

On Wed, 31 Oct 2007 19:44:41 -0500, General Schvantzkopf wrote:

I'm trying to clone a Win2K disk using Fedora Live on a USB FLASH
disk. I did a

dd if=/dev/sda of=/dev/sdb

It seems to have cloned the MBR correctly and the partition layout
looks correct when I look at it using GParted. However when I tried
to the boot the cloned 2K disk it started to boot and then failed
with an inaccessible boot disk error. When I booted the original 2K
disk and tried to look at the cloned disk it said that the disk
wasn't formatted. So it appears that the NTFS file system wasn't
cloned correctly.

The source disk is an old 40G that I had laying around, the
destination disk is a new 500G. After the dd there was a 40G
partition on the 500G disk and dd reported that it copied the right
number of bytes.

Is there a switch to dd that I need to add to the command? Does
anyone have any idea about what went wrong?

The partition table uses (cylinders, heads, sectors). If the two
drives have a different number of (heads,sectors), then I don't think
strict "dd" will work. The drives have to be almost identical to work,
especially with Windows in the mix. However, if the OS is only
GNU/Linux, then it might work because LBA disk mode is always used-
even by the loader.

I think the dd worked fine, as long as I have the old drive in the
system I can boot the cloned partition. The problem is that Windoze is
looking for something on the E: partition (where the original Win2K
install was done) but the cloned partition is C:. In Linux I would just
edit /etc/ fstab and I'd be done but I don't know how to do an
equivalent thing in Windows. You can change drive letter in Windows but
you can't do it to the root partition and the problem seems to be that
I need to change the new drives to be the same as the old drive's
number.

IME, upgrading windows drives can be tricky, and can be made a bit worse
if the original disk remains in the system at the first attempt to
restart the Windows system with the upgraded disk. It will sometimes
"just work" if the upgraded disk can reclaim the drive letters. But
IIRC, there are cases when the drive letters will be wrong for whatever
reason. There is a fairly quick method to reassign drive letters, if
they get messed up. The tool to use is BART PE, the live CD in the
windows world. To fix the letters, boot BART PE with the upgraded disk
installed only. When the startup completes and the menu appears, then
you can manually edit the registry on the upgraded disk. Make some notes
on paper how Bart PE is assigning your disk partitions. Then use the
registry editor from the saved system (say x:\winnt\system32\regedit32).
CAUTION: making a mistake while working with the Windows registry can
totally hose a Windows system!

1. Navigate to HKEY_Local_Machine->System->MountedDevices. The entries
show how BART PE is assigning the letters. Save these entries to a temp
file (Registry -> Save Key)

2. Load the "hive" for your upgraded system: (Registry->Load Hive), then
point to the file, x:\winnt\system32\system. Load it at some point (say:
sys2).

3. Navigate to the same point as described in step 1, but on sys2:
HKEY_Local_Machine->Sys2->MountedDevices. Restore this key using the
saved entries from step 1. Be careful. (Registry -> Restore Key)

4. If the order is not correct, then fixup the contents of the restored
keys. For example, if C: and D: should be reversed, then you would do as
follows:
4.a. To Save value of \DosDevices\C: (which is type "REG_BINARY") to a
temp location, first select the value by double-clicking. A "CTRL-C"
will copy the value to the clipboard. Now, paste it to a temp location-
a text file works fine.
4.b. Copy the value of \DosDevices\D: to the clipboard using the same
technique as 4.a.
4.c. Overwrite the value of \DosDevices\C: with the value in the
clipboard (CTL-V).
4.d. Copy the value from the text file (saved in step 4.a) back to the
clipboard (CTL-C).
4.e. Overwrite the value of \DosDevices\D: with the value in the
clipboard (CTL-V).

The values have now changed places. Fixup any other mismatches using
this technique.

5. When your done fixing letters, then unload the hive, sys2. 6.
Shutdown BartPE and reboot using the upgraded disk. If everything worked
as planned, the drive letters should be correct.


I should explain why I'm going though this pain. My girlfriend uses XP
and no amount of pleading is going to get her to change. I'm planning
on replacing an old 80G drive in her system with a new 500G, I also
want to come up with a reasonably procedure for backing up her
environment. What would be a pimple removal in Linux is a heart lung
transplant in Windows. In Linux you would just do a clean install of
the OS, which is a 20 minute operation, and copy the other partitions.
If you have a distro sensitivity you can run a VM on top of the host OS
and you are done, I do that all the time running CentOS VMs on top of
Fedora. A backup in Linux is just an rsync of your important data and
binary applications to another system. In Windows none of this is
possible because the applications and the OS are entangled plus they
all have licensing issues. Instead of backing up a few gigabytes you
need to backup everything because you can't disentangle the OS + Apps +
Data. I tried doing a VMware snapshot of here system so that she could
run it as a VM (which can be easily copied to another disk or system)
but that ran into the Windows Activation problem. When I booted the VM
it demanded to be activated which I couldn't do without risking
deactivating the host OS on her system. I can't do a clean install of
the OS either because she claims that it took her months to get the
system into the state that she likes and because she would have to
reactivate both XP and some of her apps like Photoshop (she had to call
Adobe when she moved over to this box in the spring).

The bottom line is that I need a procedure for moving and backing up an
XP environment. I'm trying to do this with tools I understand, which
means Linux tools, but I've had to learn more about Windows then I ever
wanted to know. Does anyone have any suggestions for accomplinsing this
task?

Windows has a backup tool called "DriveSnapshot", which is $30, IIRC. I
prefer making backups on Windows systems using ntfsclone. This can be
done with either a dual boot system, or else booting a live CD with the
ntfsprogs included.

p.s. The reason that I've been using 2K and not XP for my experiments
is that 2K doesn't use Activation, it uses the old serial number
method. I'm doing this on my sandbox machine so I can start from
scratch if someone has a straight forward procedure for doing this.

Note: comments inline.

I was away yesterday, and haven't read all of the responses on this
thread, yet. Pardon me, if this response is covered farther down.

Thanks, this is really useful information. Hopefully I won't have to take
advantage of it.
.



Relevant Pages

  • Re: Question: move disk from linux machine to windows machine
    ... is not a disk but a partition - in this case, ... has nothing to do with this disk. ... have 2 types of hard drives on one machine, ... have only the Windows bootloader reside on the IDE drive, ...
    (comp.os.linux.hardware)
  • Re: Reverting from Vista to XP
    ... You will also need SP1 or SP2 for Windows XP to support drives larger than ... How to enable 48-bit Logical Block Addressing support for ATAPI disk drives ... The partition would only see it as a 130 GB drive. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Dual Boot Instructions
    ... the PHYSICAL DISK number, ... Partition and Boot Volume as well as other things. ... You should, at any one time, see ONE System Partition and ONE Boot Volume - ... for the typical two floppy drives and assigning Drive C: ...
    (microsoft.public.windows.vista.hardware_devices)
  • Re: Boot Problem
    ... Right mouse click the dest disk> Advanced> Edit ... but it should eventually boot to Windows. ... I see a lot of posts in here about the ability of Acronis to clone drives. ... I have managed to successfully copy by DELETING partition, ...
    (microsoft.public.windowsxp.hardware)
  • Re: Dual Boot Instructions
    ... OS on a separate partition. ... the PHYSICAL DISK number, ... You should, at any one time, see ONE System Partition and ONE Boot ... The name stuck when we added hard disk drives, ...
    (microsoft.public.windows.vista.hardware_devices)