Mombu the Microsoft Forum

Mombu the Microsoft Forum > Microsoft > Windows 2003 Server (TECHNET) > Allocation Units
REGISTER NOW! Search Today's Posts Mark Forums Read




Reply
 
Thread Tools Search this Thread Display Modes
1 21st April 12:20
mckirahan
External User
 
Posts: 1
Default Allocation Units



Can WSH determine the allocation unit size of a drive?

It's not a Property of the Drive Object per Wrox's
"Windows Script Host Programmer's Reference".

Thanks in advance.

P.S. I don't want to call CHDSK and parse the output:
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


2 21st April 12:20
mckirahan
External User
 
Posts: 1
Default Allocation Units



One way is to calculate the difference in a drive's AvailableSpace
before and after the creation of a file:


Option Explicit
WScript.Echo "Allocation Unit Size = " & AllocationUnitSize("C:")

Function AllocationUnitSize(DRV)
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objGDR
Set objGDR = objFSO.GetDrive(DRV)
Dim strCTF
strCTF = DRV & "\" & objFSO.GetTempName()
Dim objCTF
Set objCTF = objFSO.CreateTextFile(strCTF)
Dim intSIZ
intSIZ = objGDR.AvailableSpace
objCTF.WriteLine ""
intSIZ = intSIZ - objGDR.AvailableSpace
Set objCTF = Nothing
objFSO.DeleteFile(strCTF)
Set objFSO = Nothing
Set objGDR = Nothing
AllocationUnitSize = FormatNumber(intSIZ,0) & " bytes"
End Function

Is there a better way?
  Reply With Quote
3 21st April 12:21
mr_unreliable
External User
 
Posts: 1
Default Allocation Units


I was CERTAIN that I could find this in one of the
"Windows Management Information" (wmi) classes,
but no luck.

You might try the win32_volume class (blocksize property)
which I couldn't test because my copy of wmi doesn't
include it...

There is also the sysInternals utility "NTFSInfo" utility,
found here:

http://www.microsoft.com/technet/sys.../NtfsInfo.mspx

NTFSInfo will tell you the allocation unit size, but then
you indicated that it would be unacceptable for you to peruse
the output of any utility.

cheers, jw
__________________________________________________ __________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
  Reply With Quote
4 21st April 12:21
mckirahan
External User
 
Posts: 1
Default Allocation Units


[snip]

Thanks for your feedback.

I looked at what Scriptomatic could provide and thought
DiskDrive, DiskPartition, or LogicalDisk would have it -- not...
  Reply With Quote
5 22nd April 21:54
tdm
External User
 
Posts: 1
Default Allocation Units


Could this be as simply as taking the BytesPerSector from
Win32_DiskDrive and multiply by 8 ? I guess this works
for me with an allocation unit size of 4096, but I dont believe
I have ever seen anything other then 4096 so I have no
way to test this theory. Just thinking out loud I guess.

TDM
  Reply With Quote
6 22nd April 21:55
mckirahan
External User
 
Posts: 1
Default Allocation Units


Nope. 512 * 8 = 4,096 for me too via DiskDrive; however,
my Win98SE PC's allocation unit is 32,768 bytes per chkdsk.

Thanks anyway.
  Reply With Quote
7 26th April 04:13
asdf
External User
 
Posts: 1
Default Allocation Units


The guy is digging deep today, isn't he :-)
  Reply With Quote
8 26th April 04:14
mckirahan
External User
 
Posts: 1
Default Allocation Units


My copy of Scriptomatic V2 doesn't show it either.
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


9 16th August 23:26
asdf
External User
 
Posts: 1
Default Allocation Units


Use a fail safe for your plan.


Tthat is Florida goes under water , I will move, and know where to.

------------------------------------

Do have "discuss" and "try" other's software.

Not only Ms, the official "used car salesman's" approach.


--------------------------------------------

Friendly
  Reply With Quote
10 17th August 01:12
d.r.
External User
 
Posts: 1
Default Allocation Units


Hi McKirahan,

Try this:

C:\Program Files\Support Tools>fsutil fsinfo ntfsinfo
....
Bytes Per Sector : 512
Bytes Per Cluster : 4096
....


The "fsutil" tool is present in WinXP and Windows 2003. Download the
Windows 2000 Resource Kit Tools for a copy for Win2000.

Regards,
Dave.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes







Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
Also visit Ogoun the Usenet Archive
666