Jump to content


anyweb

How can I deploy Windows with a custom blocksize using SCCM ?

Recommended Posts

Introduction

I had the task to figure out how to install Windows 10 with a blocksize of 16k in order to align with the deduplication of data on a HPE 3PAR Thin Technologies when used with VMWare ESXi 6.5 Update 2.

chunksize.pngNote: You can use the info here to also modify Windows Server installs to avail of 64k blocksizes by adjusting the script.

You can see some information about performance of VMWare virtual machines with different settings here.

A quick look at the formatting steps in a default (or even an MDT based) task sequence did not offer any option for configuring block size. By default, Windows will be installed with a 4k block size, and you can determine the blocksize with the following PowerShell.

Get-CimInstance -classname Win32_Volume | Select-Object Label, Blocksize | Format-Table -AutoSize

You can clearly see the 4k blocksize (4096 bytes) listed below on a default Windows 10 installation.

get-ciminstance.png

Step 1. Import the drivers into SCCM

Note: This blogpost assumes you want to deploy Windows with custom blocksizes on ESXi 6.5 Update 2, if you are using different hardware, use the suppliers drivers as appropriate.

After downloading, extracting the necessary drivers from here,

import-drivers.png

create a driver package in SCCM and distribute it to your distribution points.

driver-package.png

Step 2. Add drivers to the boot image

Next I needed to import storage and network drivers into my SCCM boot image namely

  • VMXNET3 Ethernet Adapter
  • PVSCSI Controller

The other two Mouse vmware drivers are optional (but recommended).

drivers-in-boot-image-1.png

Note: I won’t go into detail about importing drivers into a boot image as that is not the focus of this blog post.

update-boot-image-to-dps.png

You can obtain these drivers from the VMWare Tools iso on the ESXi or via here.

Step 3. Edit a task sequence

Edit an already created task sequence, locate the Initialization Group and add the following Group (before the Partition if necessary Group) called:

Prepare variables for VMWare ParaVirtual

prepare-variables.png

On the Options tab of the new group, set it to run with the following Query.

SELECT * FROM Win32_ComputerSystem WHERE model like "VMWare%"

options-tab.png

Create a new Set Task Sequence variable step where the variables name is OSDISK and the value is 😄

set-osdisk.png

Create another Set Task Sequence Variable step where the variables name is BlockSize and the value is 16K

BlockSize-variable.png

In the Partition if necessary Group, create a new sub-group called Format custom BlockSize VMWare ParaVirtual

format-custom-blocksize-group.png

On the Options tab of the new group, set it to run with the following Query.

SELECT * FROM Win32_ComputerSystem WHERE model like "VMWare%"

options-tab-for-format.pngNext create a Run Command Line step called Create custom diskpart script and paste the following code into it, set the timeout to 1 minute.

cmd.exe /c echo select disk 0 > x:\diskpart.txt &  cmd.exe /c echo clean >> x:\diskpart.txt &  cmd.exe /c echo convert gpt >> x:\diskpart.txt &  cmd.exe /c echo create partition primary size=2048 >> x:\diskpart.txt &  cmd.exe /c echo format quick fs=ntfs label="Windows RE Tools" >> x:\diskpart.txt &  cmd.exe /c echo assign letter="T" >> x:\diskpart.txt &  cmd.exe /c echo set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" >> x:\diskpart.txt &  cmd.exe /c echo gpt attributes=0x8000000000000001 >> x:\diskpart.txt &  cmd.exe /c echo create partition efi size=1024 >> x:\diskpart.txt &  cmd.exe /c echo format quick fs=fat32 label="System" >> x:\diskpart.txt &  cmd.exe /c echo assign letter="S" >> x:\diskpart.txt &  cmd.exe /c echo create partition msr size=128 >> x:\diskpart.txt &  cmd.exe /c echo create partition primary >> x:\diskpart.txt &  cmd.exe /c echo format quick fs=ntfs label="OSDisk" unit=%BlockSize% >> x:\diskpart.txt &  cmd.exe /c echo assign letter=%OSDISK% >> x:\diskpart.txt &  cmd.exe /c echo list volume >> x:\diskpart.txt &  cmd.exe /c echo exit >> x:\diskpart.txt

This basically creates a txt file on x:\ called diskpart.txt which contains the info needed to format our chosen partition (in this case OSDISK) with a 16K BlockSize. You can modify the script as you wish to use say, a 64K size for Windows Server OS and change the desired partition structure.

create-custom-diskpart-script.png

Next, create another Run Command Line step to do the following command

cmd.exe /c diskpart /s x:\diskpart.txt

execute-diskpart-commands.png

Finally, add an if none of the conditions is true option on all the following Format groups (such as Script exists and non-NTFS partitions and Script does not exist or no partitions….) which is like so…

if-none-of-the-coniditions-is-true.png

and…

format-and-partition-disk-UEFI.png

Save the changes and close the task sequence editor.

Step 4. PXE boot a VMWare Virtual machine running on your ESXi 6.5 host

After PXE booting a VMWare virtual machine, select the task sequence above and verify that it creates the x:\diskpart.txt file as shown below.

If you look at the highlighted line in the diskpart script, you can see unit=16K, which is the  custom BlockSize variable defined earlier.

custom-diskpart-script-showing-the-custo

Once the machine has finished deploying, you can verify the blocksize using the PowerShell commands at the start of this blogpost.

16k-blocksize-confirmed.png

Job done !

Note: If you find that your virtual machines are BSOD’ing during deployment with a Driver PNP Watchdog blue screen error, then power them off, and remove any snapshots. This appears to be a known bug with VMWare ParaVirtual and Windows 10.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.