5

I'm using dd (under cygwin) to copy a shadow image of a disk in windows. Shadow copy will only give me a partion, so what I am doing is:

1) using dd to grab the disk header (32k on Win2003)
2) using dd to copy the shadow partition
3) using dd to copy the end of of the disk (8 meg reserved on Win2003)
4) stitch them all together and boot on KVM

I need the exact size of all the partitions and non partitioned space on this windows drive. Unfortunately most windows disk tools seem to fudge the numbers a bit, or at least give me a different size than Linux does. I could guess like this 32k + partition size + 8M, but I want to double check. If I make a mistake I could lose data.

This is on a remote & live Windows 2003 server so no offline solutions will be helpful. Latest cygwin is installed.

3
  • 1
    I've actually solved the original disk imaging problem, but I never did figure out how to get an accurate byte size of a windows disk (the whole disk not partitions). This can't be that difficult ... Feb 1 '11 at 19:59
  • I'd also like to add that I don't think the value shown in "My Computer>Disk>Disk Properties" is totally accurate. When I imaged a Windows 2003 machine I got a raw disk image of 73274490880 bytes but disk properties reports 73262534656. Feb 1 '11 at 20:33
  • The plot thickens though: disk properties in windows = 73262534656, wmic = 73270794240, disk image on linux (ls -la) = 73274490880, wmic on virtual machine created from disk image = 73270794240. My theory is that Windows doesn't report on the empty space it reserves at the end of the disk. Feb 1 '11 at 21:02
8
+50

Have you tried checking WMI for accurate values? You can query common aliases through the wmic command:

C:\>wmic partition get name,bootable,size,type
C:\>wmic diskdrive get size,status,TotalCylinders,TotalSectors,SCSIPort,SCSITargetId,model
7
  • Thank you, that's a great command. The plot thickens though: disk properties in windows = 73262534656, wmic = 73270794240, disk image on linux (ls -la) = 73274490880, wmic on virtual machine created from disk image = 73270794240 Feb 1 '11 at 20:55
  • How are you creating that disk image -- using the process above? Also, there's 'wmic volume get capacity'..
    – beans
    Feb 1 '11 at 21:27
  • i was first with the wmic command
    – tony roth
    Feb 2 '11 at 5:10
  • True but Ben's answer gave more information. I still don't have what I need to solve this problem, Linux reports one size and Windows another. Not sure which is accurate ... Feb 2 '11 at 17:20
  • yea I was just being a wiener!
    – tony roth
    Feb 2 '11 at 21:12
2

wmic diskdrive : for physical size
wmic logicaldisk : for you know

0

Not exactly an answer, but you could use disk2vhd, then convert it for KVM using qemu-img convert -f vpc -O qcow server.vhd server.qcow command.

2
  • The problem is that I don't have any local storage. I'm using dd because it tunnels through ssh. Jan 12 '11 at 18:46
  • Could get creative with iSCSI, but you're probably better off gettind dd working.
    – Chris S
    Jan 12 '11 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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