Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
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 ... –  Antonius Bloch 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. –  Antonius Bloch 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. –  Antonius Bloch Feb 1 '11 at 21:02

3 Answers 3

up vote 4 down vote accepted
+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
share|improve this answer
    
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 –  Antonius Bloch 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 ... –  Antonius Bloch Feb 2 '11 at 17:20
    
yea I was just being a wiener! –  tony roth Feb 2 '11 at 21:12

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

share|improve this answer

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.

share|improve this answer
    
The problem is that I don't have any local storage. I'm using dd because it tunnels through ssh. –  Antonius Bloch 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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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