Get exact size in bytes of a disk & partitions in windows
Solution 1
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
Solution 2
wmic diskdrive : for physical size
wmic logicaldisk : for you know
Related videos on Youtube
![Antonius Bloch](https://i.stack.imgur.com/xA6Ne.png?s=256&g=1)
Antonius Bloch
Hi there. I'd love to share, but "Deny by default". If you can't tie the information I'm spilling on Stack Exchange then you can't use it to triangulate an attack on the systems I'm responsible for. I'm careful with what I post, but you can never be too careful, can you?
Updated on September 17, 2022Comments
-
Antonius Bloch almost 2 years
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 KVMI 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.
-
Antonius Bloch over 13 yearsI'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 over 13 yearsI'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 over 13 yearsThe 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 over 13 yearsThe problem is that I don't have any local storage. I'm using dd because it tunnels through ssh.
-
Philip over 13 yearsCould get creative with iSCSI, but you're probably better off gettind
dd
working. -
Antonius Bloch over 13 yearsThank 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
-
Muhammad Danish over 13 yearsHow are you creating that disk image -- using the process above? Also, there's 'wmic volume get capacity'..
-
tony roth over 13 yearsi was first with the wmic command
-
Antonius Bloch over 13 yearsTrue 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 ...
-
tony roth over 13 yearsyea I was just being a wiener!
-
atroon over 13 yearsMy gut says that if wmic agrees on the original and restored dd images, then you're in good shape not to lose data.
-
Chloe over 6 years
ERROR: Description = Not found