Skip to content

Instantly share code, notes, and snippets.

@nanoDBA
Last active June 13, 2023 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanoDBA/fbee092058bd7e8956c8d9b261c5b231 to your computer and use it in GitHub Desktop.
Save nanoDBA/fbee092058bd7e8956c8d9b261c5b231 to your computer and use it in GitHub Desktop.
Download / Extract DiskSpd
<# copy DiskSpd to c:\DiskSpd after downloading it#>
cd $env:temp
Start-BitsTransfer -Destination .\DiskSpd.zip -Source 'https://aka.ms/getdiskspd'
$Path = 'c:\DiskSpd'; If(-not (Test-Path $Path)){ mkdir $Path }
Expand-Archive -Path .\DiskSpd.zip -OutputPath C:\DiskSpd
cd \
<#
"This example command line will run a 30 second random I/O test using a 20GB test file located on the T: drive, with
a 25% write and 75% read ratio, with an 8K block size. It will use eight worker threads, each with four outstanding
I/Os and a write entropy value seed of 1GB. It will save the results of the test to a text file called
DiskSpeedResults.txt. This is a pretty good set of parameters for a SQL Server OLTP workload."
Run CMD.EXE and paste the following, changing volume letters as needed:
c:\DiskSpd\amd64\diskspd.exe –b8K –d30 –o4 –t8 –Suw –r –w25 –L –Z1G –c20G T:\io.diskspd64-bit.testfile.dat > c:\DiskSpd\DiskSpeedResults.txt
source: https://sqlperformance.com/2015/08/io-subsystem/diskspd-test-storage
Delete DiskSpd files - copy your c:\DiskSpd\DiskSpeedResults.txt first
rd -Recurse -Force C:\DiskSpd
#>
$diskSpdDriveLetter = 'M'
$file_description = "volume_$($diskSpdDriveLetter)_EBS_io1_1000GiB_16000_iops_throughput_NA_4k_blocksize_NTFS_formatted_$($env:COMPUTERNAME)"
$filenameResultsDiskSpd = ("$env:USERPROFILE\Documents\" + [string](Get-Date -format "yyyy-MM-dd__HHmmss") + "_" + $file_description + ".txt" ); #assign $filename variable
$fileNameTestFile = "$($diskSpdDriveLetter):\io.diskspd64-bit.testfile.dat"
# WARNING: this will delete the file if it exists - 100GB file takes a while to create
if(Test-Path $fileNameTestFile) { Remove-Item $fileNameTestFile -Force -Confirm:$false -ErrorAction SilentlyContinue }
#& c:\DiskSpd\amd64\diskspd.exe -b1M -d60 -o32 -t2 -w100 -Z1G -Suw -Ln -si -c100G $($fileNameTestFile) > $($filenameResultsDiskSpd)
& c:\DiskSpd\amd64\diskspd.exe -b8K -d60 -o4 -t8 -w20 -Z1G -Suw -Ln -si -c100G $($fileNameTestFile) > $($filenameResultsDiskSpd)
if(Test-Path $filenameResultsDiskSpd) { Write-Output "$filenameResultsDiskSpd exported"}
else { Write-Output "ERROR: $filenameResultsDiskSpd not found" }
# open the file in notepad
notepad $filenameResultsDiskSpd
# remove the test file
if(Test-Path $fileNameTestFile) { Remove-Item $fileNameTestFile -Force -Confirm:$false -ErrorAction SilentlyContinue }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment