Jump to content











Photo
* * * * * 4 votes

CloneDisk


  • Please log in to reply
436 replies to this topic

#1 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 19 July 2009 - 06:17 PM

Hello Gents,

I made a small freeware app that allows one to clone a drive (physical or logical) to/from another drive or image.

On top of that the tool can :

-save/restore the MBR or BS,
-delete the layout of the drive, 
-wipe with 0's,
-create a raw image file,
-make a vmdk/vhd from a raw image file to boot your cloned disk in vmware,
-do various operations on the registry around booting,
-format any device to fat16/fat32/ntfs/exfat/udf (includig usb pen),
-read faulty devices (with bad sectors for instance),
-perform speed tests,
-edit the partition table, view the boot sector ,
-create a disk, create a partition,
-extend / shrink a volume.

Tool can be downloaded here or here
There are plenty of other tools (and possibly better) that can do the same.
What I was looking for was a GUI (no command line tool), merging several functionalities at once and free.

Feedback and requests welcome :lol:

Regards,
Erwan.

Attached Thumbnails

  • clonedisk2.png
  • clonedisk0.png
  • clonedisk1.png


#2 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10,122 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 19 July 2009 - 06:35 PM

Very good work, thank you for sharing.

I can definitively see some interest in using this tool to convert some physical server machines onto emulated machines.

Any chances of also adding support to create .VDI (Virtual Box) or .VHD (Virtual PC) images?

.VDI would be interesting because both VirtualBox and Ubuntu are what we currently use for running these emulated machines and .VHD would be interesting because of the support to boot directly from .VHD files on newer Windows platforms.

Nevertheless, it's already a very useful tool! :lol:

btw: Wouldn't this presentation be better placed on the project forge section?

#3 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 19 July 2009 - 06:42 PM

Hi Nuno Brito,

VHD support is on its way.
A few more lines of code and version 1.4 will be there.

VDI, if you have some specs or links, I'd gladly have a look at it.

About project forge : I did not dare to post there :lol:

Regards,
Erwan

#4 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10,122 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 19 July 2009 - 08:50 PM

VHD support is on its way.
A few more lines of code and version 1.4 will be there.

Good to hear this. ;)


VDI, if you have some specs or links, I'd gladly have a look at it.

I *think* this is the most complete guide on the binary specs: http://forums.virtua...opic.php?t=8046

It's a work in progress, the topic author seems a very good person to exchange questions about the inner functioning of this binary structure.

About project forge : I did not dare to post there ;)

Are you kidding? This is a five star project forge entry! ;)

I'm already imagining it as a tool to move an offline server or desktop OS onto a virtual machine or automate the whole OS backup as VDI onto another machine on the LAN to be used as direct replacement of the physical machine in case of hardware malfunction, very cool stuff.

:lol:

#5 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7,098 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 20 July 2009 - 10:07 AM

VDI, if you have some specs or links, I'd gladly have a look at it.


Also a few "sparse" infos can be found here:
http://www.boot-land...?showtopic=4856
(where jerh/Jerome posted his thread referened by Nuno above)

OT, but not much, surprisingly the qemu-img.exe even in latest Qemu (0.10.5), which can be found here for Windows:
http://www.bttr-software.de/qemu/
appears not to have take notice of the success of Virtualbox and does not provide a conversion method for .vdi images:

C:\qemuman>qemu-img.exe

qemu-img version 0.10.5, Copyright (c) 2004-2008 Fabrice Bellard

usage: qemu-img command [command options]

QEMU disk image utility

...

...

Supported formats: nbd parallels qcow2 vvfat vpc bochs dmg cloop vmdk qcow host_

device raw


Though an unofficial patch exists (that may be of inspiration for your code):
http://qemu-forum.ipi.fi/
http://qemu-forum.ip....php?f=2&t=4788

Once you get into the .vdi thing, you may also want to provide an updated patch for it . ;)

:lol:


jaclaz

P.S.: Posting a link to this thread here ;):
http://www.msfn.org/...opic=100299&hl=

#6 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 20 July 2009 - 07:49 PM

Thanks Jaclaz for the links and advertisement on msfn ;)

I am almost done with VHD, only the checksum gives me a hard time :lol:
I am stuck on a dumb function for hours and it gets me mad ...

This C function

ULONG
CalculateChecksum(
__in_bcount(Length) PVOID Buffer,
__in ULONG Length
)
/*++
Routine Description:
This routine calculates the one's complement of the checksum of all the
bytes with the given range, excluding the address to ignore.
Arguments:
Buffer - Pointer to the buffer to calculate the checksum for.
Length - Length of the buffer in bytes.
Return Value:
Checksum.
--*/
{
PUCHAR address = NULL;
ULONG checksum = 0;
checksum = 0;
address = (PUCHAR)Buffer;
while (Length != 0)
{
checksum += *address;
Length -= 1;
address += 1;
}
return ~checksum;
}

to this delphi code

function CalculateChecksum(var buf; length:ulong):ulong;
var
p:pword;
sum: ulong;
begin
p:=@buf;
sum:=0;
while (Length <> 0) do
begin
sum := sum + uchar(p^);
dec(length);
inc(p);
end;
Sum := not Sum;
result:=sum;
end;

produces a slightly different number and I dont get it ;)

If a developper nearby happens to see the light...

About VDI, I am quite confident (maybe I should not...) that I'll manage it.

Coming back to VHD, is there any disk driver I should inject in my XP test before I make a VHD of it?

Thanks,
Erwan.

#7 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 20 July 2009 - 08:09 PM

About the C code above, ignore it, got it working :lol:

/Erwan

#8 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 20 July 2009 - 09:48 PM

Version 1.4 can now backup a physical disk to an VHD (VirtualPC) file.

I had to force heads to 16 and sectorspertrack to 63 (cylinders are then calculated on the total_sectors value of the source disk).
I am not sure (yet) if this is by the book but I was able to mount the VHD in a VirtualPC session and access my partitions from there.
I did not tested fully a boot from such a VHD file yet.

Regards,
Erwan.

#9 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10,122 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 20 July 2009 - 10:29 PM

Thanks for the update, that was really fast! :lol:

#10 Lancelot

Lancelot

    Frequent Member

  • .script developer
  • 5,013 posts
  • Location:Turkiye/Izmir
  • Interests:*Mechanical stuff and Physics,
    *LiveXP, BartPE, SherpyaXPE,
    *Basketball and Looong Walking,
    *Buying outwear for my girlf (Reason: Girls are stupid about buying bad stuff to make themselves uglier :))
    *Girls (Lyric: Girl,...., You will be a womann, Soon)
    *Answering questions for "Meaning of life",
    *Helping people,

    Kung with LiveXP, Fu with Peter :)
  •  
    Turkey

Posted 20 July 2009 - 11:34 PM

using this tool to convert some physical server machines onto emulated machines.

yummy :lol:

Thanks a lot erwan.l ;)

#11 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 21 July 2009 - 08:48 AM

yummy :lol:

Thanks a lot erwan.l ;)


For now, I have testing cloning to Qemu and VMWare with success.
I will now test cloning to VHD and later to VDI.

I need to understand why vpc2007 wont boot to my vhd (the bios sees it thus) whereas I can use the same vhd as a non system drive from a vpc2007 operating system.

/Erwan

#12 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 21 July 2009 - 12:39 PM

Update : I did manage to boot a cloned physical XP to a vhd.
To do so, I had to disable LBA in the vpc emulated bios.

I have the feeling the geometry is not right and messes up the mbr (since i can see the vhd file fine as a secondary drive in a virtual pc O.S).

Any insights on what the geometry should be in a VHD file?
Or should I do something with the MBR after I have clonded my disk?

Regards,
Erwan

#13 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7,098 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 21 July 2009 - 03:00 PM

Update : I did manage to boot a cloned physical XP to a vhd.
To do so, I had to disable LBA in the vpc emulated bios.

I have the feeling the geometry is not right and messes up the mbr (since i can see the vhd file fine as a secondary drive in a virtual pc O.S).

Any insights on what the geometry should be in a VHD file?
Or should I do something with the MBR after I have clonded my disk?

Regards,
Erwan


Is it possible that maybe your conversion works allright but the SOURCE image is non-proper? :lol:

Try testing with images created by MKIMG/MBRBATCH:
http://www.boot-land...?showtopic=3191
http://www.boot-land...?showtopic=5000

They are definitely CHS/LBA balanced and you can test several different geometries.

I am not familiar with VHD's, but it is probable that they use nx255x63, just like recent NT based systems do. ;)

;)

jaclaz

#14 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 22 July 2009 - 06:50 PM

Jaclaz, I followed your advice and took another source and indeed this time I managed to boot fine (without playing with the bios lba settings) and I made it to the windows logo loading.

Then I got a nice BSOD but I did expect it as I may have to do something to my source before cloning it (ide settings, drivers, or else...).

Almost there :lol:

/Erwan

#15 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 22 July 2009 - 07:33 PM

I feel I need help there.
Here I am :

1/
If I convert my raw image with qemu-img, then vpc is happy.
qemu-img command line qemu-img convert -f raw -O vpc i:\w2k3.img g:\w2k3.vhd
But this is an offline cloning there, and I want to do a live cloning.

2/
If I launch my raw image in vmware, then clone my live-running system disk to vhd,
then next time in vpc gives me a c0000218 in failsafe mode or keeps rebooting after a forced chkdisk.
About the error c0000218 telling me it cant load the software hive, i can load it fine in regedit once extracted from the vhd file, so I know the hives are fine.

3/
If I launch my raw image in vmware, then clone my live-running system disk to a raw image,
then qemu launches fine, so does vmware.
That part is very handy (for me at least) but only covers vmware and qemu.

So I know my source is ok as I can launch it in vmware or qemu, or convert it via qemu-img, or even clone it live to a raw image and use it again in vmware or qemu.

So it has to be something with vpc.
Could it be a bad or mussing disk driver preventing me to boot all the way my dump to vhd?

I know that when I want to clone a live system I have to add some ide settings for qemu or add some scsi drivers for vmware.
I feel there is something similar to do for VPC but my vpc knowledge is light today.

Any hint welcome :lol:

/Erwan

#16 Siginet

Siginet

    Member

  • Developer
  • 55 posts
  •  
    United States

Posted 05 August 2009 - 10:22 PM

Maybe this is a dumb question.

Is it possible to restore an image to a computer with different hardware using this utility?

If not I think it would be a great addition to allow the capability of stripping the HAL and inputing the needed files/scripts to create a universal image of OSes like Windows XP/200/2003. :idea:

Sounds like a great imaging utility. I will be trying it out.

Thanks,
Siginet

#17 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7,098 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 05 August 2009 - 11:49 PM

Is it possible to restore an image to a computer with different hardware using this utility?

If not I think it would be a great addition to allow the capability of stripping the HAL and inputing the needed files/scripts to create a universal image of OSes like Windows XP/200/2003. :P


Isn't this what OfflineSysprep is supposed to be doing? :)
http://www.911cd.net...hp?showforum=43

:idea:

jaclaz

#18 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 08 August 2009 - 06:02 PM

Isn't this what OfflineSysprep is supposed to be doing? :idea:
http://www.911cd.net...hp?showforum=43

:P

jaclaz


Indeed, sysprep is the tool needed to move an installed OS to another computer, provided that the drivers of the target machine are in the OS database.

Without using sysprep, I managed to move an image from VPC to VM (adding the vm drivers before moving) and also from VM to Qemu (tweaking the ide drivers before moving).

I would advise to always boot in safe mode the first time after moving to "ease" the pnp detection.

Regards,
Erwan.

#19 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7,098 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 08 August 2009 - 06:16 PM

More loosely, the steps involved are detailed here:
http://michaelsteven.../moving_xp.html

What you use should be "Option #2".

The "recommanded" one is "Option #1", though, as the above may or may NOT work.

Indeed, sysprep is the tool needed to move an installed OS to another computer, provided that the drivers of the target machine are in the OS database.


Not necessarily, drivers can be"injected" offline:
http://www.911cd.net...showtopic=22313
http://www.911cd.net...showtopic=22523

jaclaz

#20 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 08 August 2009 - 07:07 PM

More loosely, the steps involved are detailed here:
http://michaelsteven.../moving_xp.html

What you use should be "Option #2".

The "recommanded" one is "Option #1", though, as the above may or may NOT work.



Not necessarily, drivers can be"injected" offline:
http://www.911cd.net...showtopic=22313
http://www.911cd.net...showtopic=22523

jaclaz


Some excellent links again :idea:
I never thought about adding drivers offline : this means I can mount my raw images, add drivers and execute it to different hosts then.

Thanks,
Erwan.

#21 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 08 August 2009 - 07:39 PM

Small update, latest clonedisk 1.4.2 finally handles cloning to VPC (vhd format) fine.
I managed to clone live a running windows 2003 to VPC 2007.

/Erwan

#22 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7,098 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 09 August 2009 - 07:53 AM

Small update, latest clonedisk 1.4.2 finally handles cloning to VPC (vhd format) fine.
I managed to clone live a running windows 2003 to VPC 2007.

/Erwan


Very good. :idea:

Spreading the word on the Winimage Forum, where this kind of question is often asked.

It would be nice if you could post some more details of the successful procedure you put in practice.

:P

jaclaz

#23 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 09 August 2009 - 10:20 AM

Very good. :idea:

Spreading the word on the Winimage Forum, where this kind of question is often asked.

It would be nice if you could post some more details of the successful procedure you put in practice.

:P

jaclaz


Hi Jaclaz,

From within a running VM on w2k3, I launched clonedisk.
I choose physicaldrive0 and dumped it to a VHD image on a network location.
Once done, I shutdown my VM and launched successfully the VHD from VPC2007.
Note that the first time I booted under VPC2007, some new hardware got detected and installed.
So basically, I cloned a VMware image to a VirtualPC image, online.

I will now try the same with a physical source (a laptop for instance).

Regards,
Erwan.

#24 ktp

ktp

    Silver Member

  • Advanced user
  • 727 posts

Posted 09 August 2009 - 12:00 PM

@erwan.l

Why clonedisk does not have the option to convert from vmdk to image file? This would be very handy for me to test boot over iSCSI with VMWare.

Since I have already several VMware virtual machines (XP, Windows 7, Vista), by converting them to disk file images (.img) I can use them for Starwind iSCSI target.

Thank you.

#25 erwan.l

erwan.l

    Silver Member

  • Developer
  • 865 posts
  • Location:Nantes - France
  •  
    France

Posted 09 August 2009 - 12:36 PM

@erwan.l

Why clonedisk does not have the option to convert from vmdk to image file? This would be very handy for me to test boot over iSCSI with VMWare.

Since I have already several VMware virtual machines (XP, Windows 7, Vista), by converting them to disk file images (.img) I can use them for Starwind iSCSI target.

Thank you.


Hi ktp,
If these are fixed disk, I could add the option to clonedisk to convert them offline.
What you can do already is to convert it online (i do that for all my vmware images) :
boot on your vm, launch clonedisk, and backup to raw image to a network location (your iscsi target / server for example).

Regards,
Erwan.

edit : about the online vs offline discussion, clonedisk is more into online cloning in order to move from one target to another.
the vmdk is not a convert operation but merely the creation of a vmdk pointer to a raw image.
so that to extent, as pointed out by Jaclaz, qemu-img tool is more adapted.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users