In the previous articles I described how to configure File Server role in a Windows Server cluster. For this setup I will choose standard standalone File Server in each site but of course it is possible to follow previous articles and build a cluster in each site.
Virtual machine
File Servers are VMs that run on top of Contoso’s Hyper-V serves.
Add a lot of disks
$ErrorActionPreference = 'Inquire' $vmName = '*data1' Get-VM -Name $vmName -OutVariable vm if (@($vm).Count -gt 1) { throw 'More VMs' } $vmDiskController = Get-VMScsiController -VM $vm -ControllerNumber 1 $pathDisks = Split-Path -Path (Get-VMHardDiskDrive -VM $vm | Select-Object -First 1).Path -Parent $pathDisks $vhd = New-VHD -Path (Join-Path -Path $pathDisks -ChildPath ('{0} - Data - Mount points.vhdx' -f $vm.Name)) -Dynamic -SizeBytes 1GB Add-VMHardDiskDrive -Path $vhd.Path -VMDriveController $vmDiskController $vhd = New-VHD -Path (Join-Path -Path $pathDisks -ChildPath ('{0} - Data - Documents.vhdx' -f $vm.Name)) -Dynamic -SizeBytes 15TB Add-VMHardDiskDrive -Path $vhd.Path -VMDriveController $vmDiskController $vhd = New-VHD -Path (Join-Path -Path $pathDisks -ChildPath ('{0} - Data - Marketing.vhdx' -f $vm.Name)) -Dynamic -SizeBytes (15TB + 1GB) Add-VMHardDiskDrive -Path $vhd.Path -VMDriveController $vmDiskController $vhd = New-VHD -Path (Join-Path -Path $pathDisks -ChildPath ('{0} - Data - Sales.vhdx' -f $vm.Name)) -Dynamic -SizeBytes (15TB + 2GB) Add-VMHardDiskDrive -Path $vhd.Path -VMDriveController $vmDiskController $vhd = New-VHD -Path (Join-Path -Path $pathDisks -ChildPath ('{0} - Data - Research.vhdx' -f $vm.Name)) -Dynamic -SizeBytes (15TB + 3GB) Add-VMHardDiskDrive -Path $vhd.Path -VMDriveController $vmDiskController $vhd = New-VHD -Path (Join-Path -Path $pathDisks -ChildPath ('{0} - Data - HR.vhdx' -f $vm.Name)) -Dynamic -SizeBytes (15TB + 4GB) Add-VMHardDiskDrive -Path $vhd.Path -VMDriveController $vmDiskController $vhd = New-VHD -Path (Join-Path -Path $pathDisks -ChildPath ('{0} - Data - ISOs.vhdx' -f $vm.Name)) -Dynamic -SizeBytes (15TB + 5GB) Add-VMHardDiskDrive -Path $vhd.Path -VMDriveController $vmDiskController
Network adapters
A lot of users access the File Servers and therefore the maximum Ethernet throughput is required. One of the best practices In order to use SMB3 Multichannel on VMs is to have multiple virtual NICs connected to same network (switch, VLAN…).
Contoso’s administrators added same number of virtual NICs as the number of physical NICs on the Hyper-V servers.
Operating system
Microsoft Windows Server 2012 R2 Update 1 with current updates.
Disks
# Online all disks Get-Disk | Where-Object -Property IsOffline | Set-Disk -IsOffline:$false # Format them Get-Disk | Where-Object -Property PartitionStyle -eq 'RAW' | Sort-Object -Property Number | Initialize-Disk -PartitionStyle GPT -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -AllocationUnitSize 4096 -Confirm:$false
# Rename all volumes $labels = 'Mount points', 'Documents', 'Marketing', 'Sales', 'Research', 'HR', 'ISOs' $labels $i = 0 Get-Volume | Where-Object -FilterScript { $_.DriveLetter -and !$_.FileSystemLabel -and $_.FileSystem -eq 'NTFS' } | Sort-Object -Property Size | ForEach-Object -Process ` { $_ | Set-Volume -NewFileSystemLabel $labels[$i++] } Get-Volume | Sort-Object -Property Size
File Server role
It is possible to install File Server role but this is not requirement because the role will be automatically installed when you create a first SMB share.
Install-WindowsFeature File-Services, FS-FileServer
Mount points
It is possible that in the future there will be much more disks in the server. It is a good idea to be ready and therefore Contoso’s admins created a small disk for mount points and now they will programatically add mount points.
$labels = 'Documents', 'Marketing', 'Sales', 'Research', 'HR', 'ISOs' foreach ($label in $labels) { $path = (Join-Path -Path 'E:\' -ChildPath $label) New-Item -Path $path -ItemType directory | Out-Null Get-Volume -FileSystemLabel $label | Get-Partition | Add-PartitionAccessPath -AccessPath $path }
SMB configuration
Contoso’s administrators want to try the performance hit of SMB Encryption so to test it they will set the most secure configuration. Only Windows 8 and Windows Server 2012 will be able to use File Servers.
Set-SmbServerConfiguration ` -EnableSMB1Protocol:$false ` -EnableSMB2Protocol:$true ` -EnableSecuritySignature:$true ` -RequireSecuritySignature:$true ` -EncryptData:$true ` -Confirm:$false ` -Verbose
Shares
Now it is possible to add shares. To simplify management of the NTFS ACLs and to simplify configuration of the DFS-R Contoso’s admins will add directory to every mount point and share it.
Now it is possible to add shares. To simplify management of the NTFS ACLs I will add directory to every mount point and share it. # Remove all manually created shares Get-SmbShare -Special:$false | Remove-SmbShare -Confirm:$false # Add new shares Get-ChildItem -Path E: -Directory | ForEach-Object -Process ` { $path = Join-Path -Path $_.FullName -ChildPath 'Share' New-Item -Path $path -ItemType directory New-SmbShare -Path $path -Name $_.Name -FullAccess 'Administrators' } # Check Get-SmbShare -Special:$false
Deduplication per directory
- It is not possible to deduplicate only specified directories but there is a workaround. There is no problem to deduplicate specified volumes that are mounted as mount points. And the mount points act as directories.
Install roles
Install-WindowsFeature -Name FS-Data-Deduplication
Enable deduplication
- All volumes with data have no drive letter so it is not possible to use Enable-DedupVolume -Volume <Drive letter> command.
Get-Volume -FileSystemLabel 'ISOs' | Enable-DedupVolume -Verbose
Add more files that are excluded from compression
$ErrorActionPreference = 'Inquire' Get-DedupVolume | ForEach-Object -Process ` { $noCompressionFileType = $_.NoCompressionFileType $noCompressionFileType += '7z' $noCompressionFileType += 'rar' $noCompressionFileType += 'avi' $noCompressionFileType += 'mpg' $noCompressionFileType += 'mpeg' $noCompressionFileType += 'mp3' $noCompressionFileType = $noCompressionFileType | Select-Object -Unique $_ | Set-DedupVolume -NoCompressionFileType $noCompressionFileType } Get-DedupVolume | Format-Table -Property ` Volume, @{ Expression = { ($_.NoCompressionFileType -join ', ') }; Label = 'NoCompressionFileType' }
No minimum file age (only for testing purposes)
Get-DedupVolume | Set-DedupVolume -MinimumFileAgeDays 0 -Verbose