Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

64K ALU Support? #11

Closed
drstonephd opened this issue Jun 6, 2019 · 2 comments
Closed

64K ALU Support? #11

drstonephd opened this issue Jun 6, 2019 · 2 comments

Comments

@drstonephd
Copy link

drstonephd commented Jun 6, 2019

Being a DBA guy, I like some partitions to be formatted with a 64k allocation unit size. I don't see anything in an unattended xml that supports this; however, I'm adding the formatted VHDX drives before the deployment, so I could use New-DataVHD. Both NTFS and ReFS support 64K, so a 64K switch would work. For more general support, a ALU size parameter would be better.

Expected Behavior

Adding a ALU parameter value of 64KB to New-DataVHD would format a data partition using 64k allocation unit size. The OS drive would still use a 4 KB ALU.

Would there ever be a reason to use a smaller (e.g., 512) or a larger ALU for the OS partition? If so, perhaps the ALU parameter should apply for the data partition on the OS drive as well.

Current Behavior

The allocation unit size is always 4k.

Possible Solution

Add a parameter for the ALU to both New-DataVHD and Initialize-Partition

# Format drive using 4K or 64K allocation unit size rather then the default 4K (Only applies when DiskLayout = Data)
[int]
[ValidateSet(4KB, 64KB)]
$DataALU=4KB,

Update the hashtable in New-DataVHD used to pass values to Initialize-VHDPartition

$InitializeVHDPartitionParam = @{
    'Size'       = $Size
    'Path'       = $Path
    'force'      = $true
    'DiskLayout' = 'Data'
    'DataFormat' = $DataFormat
    'DataALU' = $DataALU
}

Update the data partition format code to use the ALU size.

#region Create the Primay partition
# Refresh $disk to update free space
$disk = Get-Disk -Number $disknumber | Get-Disk

$NewPartitionParam = @{
    DiskNumber = $disknumber
    Size       = $disk.LargestFreeExtent - $Recovery
}
if ($PartitionStyle -eq 'GPT') { $NewPartitionParam.add('GptType', '{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}') }
Write-Verbose "[$($MyInvocation.MyCommand)] [$disknumber] : Primary : Creating partition of [$($disk.LargestFreeExtent - $Recovery)] bytes"
Write-Verbose ($NewPartitionParam | out-string)
$windowsPartition = New-Partition @NewPartitionParam

$FileSystem = 'NTFS'
$AllocationUnitsize = 4KB
$Label = 'Windows'
if ($DiskLayout -eq 'Data')
{
    $FileSystem = $DataFormat
    $AllocationUnitsize = $DataALU
    $Label = 'Data'
}
Write-Verbose "[$($MyInvocation.MyCommand)] [$disknumber] : Primary : Formatting volume [$FileSystem]"
$null = Format-Volume -Partition $windowsPartition -NewFileSystemLabel $Label -FileSystem $FileSystem -Force -Confirm:$false -AllocationUnitSize $AllocationUnitsize
#endregion Primay Partiton

I have not tested this.

Steps to Reproduce (for bugs)

Context

Your Environment

  • Module version used:
  • Operating System and PowerShell version:
BladeFireLight added a commit that referenced this issue Jun 7, 2019
@drstonephd
Copy link
Author

I tested the changes you made. I now have a data partition with a 64k ALU. Thank you.

@drstonephd
Copy link
Author

I'm new to GitHub. (Yep, dianosour here.) I'm not sure I'm the one to close this, but I will try. My first close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant