michalpawlak
Enthusiast
Enthusiast

Block size during format of drives

Hello All,

I have came across small challange, for some of Windows server deployments there is need for extra drives formated with block size: 64k. I thought it is something handled out of the box, but it turns to be more deficult.

What I have done, as there is not standard custom property which can be used, is trying to play with property Command.Format.Options which is not documented but is part of formatjs.js script.

However did not bring any results:( and partitions are still formated with default 4k

Does any of you tried to attach extra paramters to format command? In my case I need to add /a:64k

Script from  formatjs.js 

// build the command string, add format options if present

    var theCommand = "%comspec% /c format " + letter + ": /fs:" + FS + " /q /v:" + label + " /y";

if (bag.exists("Command.Format.Options")) {

theCommand = theCommand + " " + bag.get("Command.Format.Options");

}

 

I am running 7.4

 

 

// build the command string, add format options if present
    var theCommand = "%comspec% /c format " + letter + ": /fs:" + FS + " /q /v:" + label + " /y";
if (bag.exists("Command.Format.Options")) {
theCommand = theCommand + " " + bag.get("Command.Format.Options");
}
 
2 Replies
daphnissov
Immortal
Immortal

I've done exactly this recently. I'll share my method a bit later with you. Remind me if I forget.

0 Kudos
daphnissov
Immortal
Immortal

Ok, so to address the question, this is doable but you're trying it in the wrong JS file. For clone workflows through vSphere when using the guest agent, the JS which holds this ability is diskpart_prep.js. There is a function at line 25 called "Disk" which you'll need to modify. Find line 50 and alter it so it reads like this:

lines.push("format fs=\"" + this.getFileSystem() + "\" unit=65536 quick");

This is using diskpart to do the work and so the parameter for cluster size is "unit" with the block size listed in bytes. It's the same as format /A:64K.

Also, if you wanted to use GPT disks instead of the standard MBR, you'd edit this same file but on line 45 add a new one that contains the following:

lines.push("convert gpt NOERR");

Hope this helps.