Re: Cloning a disk using dd



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.

--
Douglas Mayne

.



Relevant Pages

  • 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: Cloning a disk using dd
    ... It seems to have cloned the MBR correctly and the partition layout ... to the boot the cloned 2K disk it started to boot and then failed ... The drives have to be almost identical to work, ... especially with Windows in the mix. ...
    (comp.os.linux.misc)
  • Re: Slow boot
    ... allocation of 12% has been made to System Restore on your C partition ... to monitor your C (Windows) partition. ... Advanced and check the box before Compress contents to save Disk Space. ... When you say drives I think you mean partitions, ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: A Dual-boot question; I thought C was always the partition with the running OS
    ... The Server 2003 will then call its partion "C:" Local Disk. ... When Server 2003 starts up, it will call itself "C:" and it will call the WinXP partition "E:", but again, who cares? ... The OS then assigns drive letters to the first primary partition recognized on each successive hard disk. ... Because they're on separate hard drives, ...
    (microsoft.public.windowsxp.setup_deployment)
  • Re: Windows hogging up space
    ... - bad news - doesn't work that way with Windows XP. ... Drives are cheap. ... Is hibernate turned on and do you use that feature? ... You mean to change the size of the C partition? ...
    (microsoft.public.windowsxp.help_and_support)