Cloning OS with Case Study: Windows NT/XP/7

So the general headline is cloning, so basically backing up you system. Some commercial software that was mentioned when I researched was:

There are a lot more, see for example here: http://ghost.radified.com/ghost_alternatives.htm
But as I am a fan of open source software or at least free software I preferred playing with these programs or collections:

I ended up using Clonezilla. I thought the user interface was the best (PING had some issues if I recall correctly and the System Rescue Disc has no user interface for cloning at all). It also used an up-to-date backup tool called Partclone (last update: 2010-03-04) where as PING and System Rescue Disc both feature Partimage (last update: 2009-09-24). My main reason for switching was because I failed cloning single partitions with an operating system (OS) on them, which turned out not to work with any of those programs though. More about this follows. Also Clonezilla integrates USB nicely. I was not aware of a seamless support of USB with the other two programs. But I might have missed that.

General notes:

  • Clonezilla is pretty straight forward to use. There should hardly be problems concerning the user interface and its features.
  • PING and System Rescue disc allowed cloning a partition an restoring it to another partition with a different name. I.E. backup partition sda1 and restore to sda2. Clonezilla did not allow that. Clonezilla will show a message proclaiming that the image is corrupt.
  • Cloning a windows partition i.e. sda1 and restoring it to different partition sda2 would always break windows for me (at least Windows XP). That data was there, yet booting would always show an error like filesystem corrupted (I forget the exact message, sorry), when I try to boot.
  • I did not try to restore windows to the same windows partition. Nor did I try restoring windows to a partition with the same partition name on a different hard drive. But suspect that the first will work and the second has good chances to succeed. See discussion about successful restoration below though.
  • Cloning the whole disc and restoring it to any other disc worked fine. If you clone to a different hard disc (i.e. of another computer with different hardware setup) though you run into problems you also get when putting a hard drive with windows into another computer. Details what to do about that will follow.

Windows XP
This is the one I concerned my self with the most. The process of Cloning and restoring a whole hard drive containing a partition with Windows XP to another hard drive in another computer worked for me without problems. The problem was that Windows XP greeted me with a blue screen. This was due to the hardware change and known to Microsoft: http://support.microsoft.com/kb/314082. I was able to fix it after restoring the image using this tutorial featuring Offline NT Password & Registry Editor: http://blog.mcbachmann.de/linux/windows-bluescreen-0x0000007b-inaccessible_boot_device/comment-page-1. chntpw and cabextract had to be installed using sudo apt-get install x, where x is chntpw and cabextract. Before this is possible one needs to enable the "mulit-/ universe" repositories:

  • System->Administration->Software Sources
  • check "Community maintained Open Source software (universe)"
  • check "Software restricted by copyright or legal issues (multiverse)"

.

Windows NT
I did not try this yet. Yet I found an article that might help when moving or cloning a hard drive with Windows NT on it to another computer: http://www.computing.net/answers/windows-nt/cloning-winnt-to-different-hardware/22164.html

Before you clone, uninstall network card software and network card drivers, video card software and video drivers, sound card software and sound drivers, modem drivers, and any additional pci cards installed. Basically, you want to strip down the O/S proprietary drivers and use the windows generic drivers. You are trying to minimize the BSODs.
CLONE THE DRIVE AND CHANGE THE SID ON ALL CLONED PARTITIONS
Do not boot the source computer with the clone still installed.
Move clone to new computer and press F6 at the blue "inspecting hardware configuration" startup screen. This will allow you load the mass storage driver for the new motherboard. You must press F6 quickly at this screen before the detection of the mass storage drivers or you'll get a STOP: INACCESSIBLE BOOT DEVICE error. After loading the new mass storage driver, continue bootup and reload the drivers for the rest of your hardware. Do a full inspection of the EVENT VIEWER and resolve any additional errors.

Windows 7
I only tried to clone to another partition on the same hard drive here (using PING, or rather Partimage alone). I ended up with a nice cloned partition. After reconfiguring Grub2 I had two Windows 7 entries in my Grub2 menu. Yet both booted from the same partition, I believe. I thought that was due to the fact that Grub2 uses UUIDs or VolumeIds to recognize and boot from a partition. So I changed the UUID of one of the partitions. After updating Grub2 I still had the same problem. Just for the curious: the UUID cannot be changed any Ubuntu/Linux tool I know of (which does not mean something like that does no exist) if the filesystem is NTFS, unfortunatelly. You can look at the UUIDs using the command sudo blkid There ware ways around that though:

  • You can either use Microsofts utility Volumeid.exe and the booted windows.
  • Another way to change the UUID is this(http://www.linux.com/community/blogs/howto-modify-uuid-for-an-ntfs-partition.html) using a hex editor (how to hex-edit in Linux with basic tools, see below), yet I must say it did not work for me for some reason:

    Every make the mistake of having used gparted to copy-paste some NTFS partitions on a drive and wind up with multiple partitions w/ the same UUID? For EXT2 / EXT3 this si an easy fix, because you just need to run tune2fs to alter the UUID. But there's no equivalent tool for NTFS.
    Well, This very topic recently came up on the mailing list for one of the LUGs I attend and after I shared my solution w/ the list, I thought maybe I should share it here, too.
    The *easiest* thing to do is to just alter the label of the disk using a tool like ntfslabel and altering the fstab to use the label instead of the UUID, but sometimes this just isn't enough. Sometimes, you NEED to change the UUID.
    Well, that's when we perform surgery on the NTFS superblock. Luckilly MS has actually documented the contents of the superblock pretty well, and explained that the volume serial number is the eight bytes beginning at offset 0x48. Altering that serial number will give you a new UUID. So, here's the trick:

    dd if=/dev/sda# of=my_block bs=512 count=1
    ghexedite2 my_block (or what ever hex editor you like. Alter a byte or two between 0x48 and 0x4f, inclusive)
    dd if=my_block of=/dev/sda# bs=512 count=1

    That's it! Nothing to it. Below, see a dump of one of my NTFS superblocks where I've highlighted the serial number:

    adam@adam-laptop:~$ hd block
    00000000 eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00 |.R.NTFS .....|
    00000010 00 00 00 00 00 f8 00 00 3f 00 ff 00 3f 00 00 00 |........?...?...|
    00000020 00 00 00 00 80 00 80 00 24 97 ff 04 00 00 00 00 |........$.......|
    00000030 00 00 0c 00 00 00 00 00 72 f9 4f 00 00 00 00 00 |........r.O.....|
    00000040 f6 00 00 00 01 00 00 00 69 28 05 50 64 05 50 3a |........i(.Pd.P:|
    00000050 00 00 00 00 fa 33 c0 8e d0 bc 00 7c fb b8 c0 07 |.....3.....|....|
    00000060 8e d8 e8 16 00 b8 00 0d 8e c0 33 db c6 06 0e 00 |..........3.....|
    00000070 10 e8 53 00 68 00 0d 68 6a 02 cb 8a 16 24 00 b4 |..S.h..hj....$..|
    00000080 08 cd 13 73 05 b9 ff ff 8a f1 66 0f b6 c6 40 66 |...s......f...@f|
    00000090 0f b6 d1 80 e2 3f f7 e2 86 cd c0 ed 06 41 66 0f |.....?.......Af.|
    000000a0 b7 c9 66 f7 e1 66 a3 20 00 c3 b4 41 bb aa 55 8a |..f..f. ...A..U.|
    000000b0 16 24 00 cd 13 72 0f 81 fb 55 aa 75 09 f6 c1 01 |.$...r...U.u....|
    000000c0 74 04 fe 06 14 00 c3 66 60 1e 06 66 a1 10 00 66 |t......f`..f...f|
    000000d0 03 06 1c 00 66 3b 06 20 00 0f 82 3a 00 1e 66 6a |....f;. ...:..fj|
    000000e0 00 66 50 06 53 66 68 10 00 01 00 80 3e 14 00 00 |.fP.Sfh.....>...|
    000000f0 0f 85 0c 00 e8 b3 ff 80 3e 14 00 00 0f 84 61 00 |........>.....a.|
    00000100 b4 42 8a 16 24 00 16 1f 8b f4 cd 13 66 58 5b 07 |.B..$.......fX[.|
    00000110 66 58 66 58 1f eb 2d 66 33 d2 66 0f b7 0e 18 00 |fXfX..-f3.f.....|
    00000120 66 f7 f1 fe c2 8a ca 66 8b d0 66 c1 ea 10 f7 36 |f......f..f....6|
    00000130 1a 00 86 d6 8a 16 24 00 8a e8 c0 e4 06 0a cc b8 |......$.........|
    00000140 01 02 cd 13 0f 82 19 00 8c c0 05 20 00 8e c0 66 |........... ...f|
    00000150 ff 06 10 00 ff 0e 0e 00 0f 85 6f ff 07 1f 66 61 |..........o...fa|
    00000160 c3 a0 f8 01 e8 09 00 a0 fb 01 e8 03 00 fb eb fe |................|
    00000170 b4 01 8b f0 ac 3c 00 74 09 b4 0e bb 07 00 cd 10 |.....<.t........|
    00000180 eb f2 c3 0d 0a 41 20 64 69 73 6b 20 72 65 61 64 |.....A disk read|
    00000190 20 65 72 72 6f 72 20 6f 63 63 75 72 72 65 64 00 | error occurred.|
    000001a0 0d 0a 4e 54 4c 44 52 20 69 73 20 6d 69 73 73 69 |..NTLDR is missi|
    000001b0 6e 67 00 0d 0a 4e 54 4c 44 52 20 69 73 20 63 6f |ng...NTLDR is co|
    000001c0 6d 70 72 65 73 73 65 64 00 0d 0a 50 72 65 73 73 |mpressed...Press|
    000001d0 20 43 74 72 6c 2b 41 6c 74 2b 44 65 6c 20 74 6f | Ctrl+Alt+Del to|
    000001e0 20 72 65 73 74 61 72 74 0d 0a 00 00 00 00 00 00 | restart........|
    000001f0 00 00 00 00 00 00 00 00 83 a0 b3 c9 00 00 55 aa |..............U.|

    A nice way to hex-edit in Linux using basic tools is this (http://lists.freebsd.org/pipermail/freebsd-questions/2003-July/012019.html):

    I do this fairly regularly, just use xxd. For example try this:

    cp /bin/cat ~/mycat
    vi ~/mycat
    <now editing in vi>
    [esc] :%!xxd
    <now editing mycat in hex>
    <find some innocuous string or rcsid>
    <change the values on the hex side>
    [esc] :%!xxd -r
    [esc] :wq!
    ./mycat <somefile>

    You can also 'pre' xxd transform the file, then edit it, then transform
    it back when finished.

How to setup Grub2 and how to reconfigure it is shown here: http://fstyle.de/hp_fstyle/wordpress/?p=366

A last hint: if you created an image of a whole disc, but you only want to restore one partition, you can use this tutorial featuring the Clonezilla-SysRescCD: http://clonezilla-sysresccd.hellug.gr/reloc-img.html.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

One Response to “Cloning OS with Case Study: Windows NT/XP/7”

  1. e-hacking.com says:

    List With All Windows Nt/Xp Text Commands...

    Here is a list with all Windows Nt/Xp Text Commands, enjoy ADDUSERS Add or list users to/from a CSV file ARP Address Resolution Protocol ASSOC Change file extension associations ASSOCIAT One step file association AT Schedule a command to run at a later...

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply