Posted by RvdH under Computer & Peripherals on Dec 20 2020

The SanDisk Extreme PRO USB 3.1 Solid State Flash Drive delivers the super-fast solid state performance in a USB flash drive. A game-changer in the USB storage category, flash drive offers read speeds of up to 420MB/s and write speeds of up to 380MB/s that let you transfer everything fast. With capacities of 128GB (SDCZ880-128G-G46) and 256GB (SDCZ880-256G-G46), there’s plenty of room to easily manage even massive files. The sophisticated aluminum design is both stylish and durable, and the included SanDisk SecureAccess software, with 128-bit file encryption and password protection, ensures that your private files stay private4. Plus, the SanDisk Extreme PRO USB 3.1 Solid State Flash Drive is backed by a limited lifetime warranty for added peace of mind. About a year back or so I got myself a SanDisk Extreme PRO USB 3.1 128GB Solid State-flashdrive as shown above, at first all was well I got fabulous transfer speeds reading and writing to the flashdrive nearly matching the speeds listed in the specification, eg: read speeds of up to 420MB/s and write speeds of up to 380MB/s. After a few months I started noticing the transfer speeds went down quite dramatically. The read/write speeds were no longer near the one's listed in the specification but were as good or as bad as a normal SanDisk Extreme GO USB flashdrive.

How come?
The SanDisk Extreme PRO® USB 3.1 Solid State Flash Drive is equipped with the same NAND chips that are in a SSD drive, but unfortunately SanDisk (Western Digital) forgot to include a controller capable doing some housekeeping, known as TRIM or an administrative tool that can do a SecureErase. 

TRIM is a command with the help of which the operating system can tell the solid state drive (SSD) which data blocks are no longer needed and can be deleted, or are marked as free for rewriting. In other words, TRIM is a command that helps the operating system know precisely where the data that you want to move or delete is stored. That way, the solid state drive can access only the blocks holding the data. Furthermore, whenever a delete command is issued by the user or the operating system, the TRIM command immediately wipes the pages or blocks where the files are stored. This means that the next time the operating system tries to write new data in that area, it does not have to wait first to delete it.

How to restore initial performance?
I found that, if the drive got formatted the performance got better again. Digging in a little deeper in noticed that writing nothing more as FF (ones) to the drive's freespace, basically wiping unused blocks as being done automatically with a TRIM capable controller, the speeds were near the advertised speeds again. Below you find a PowerShell script (Write-OnesToFreeSpace.ps1) that can help you restore performance on SanDisk Extreme PRO USB 3.1 Solid State-flashdrive.

Write-OnesToFreeSpace.ps1

<#
.SYNOPSIS
 Writes a large file full of ones (FF) to a volume in order to allow a storage
 appliance to do a TRIM like command to wipe the storage space being erased.

.DESCRIPTION
 Creates a file called Trim.tmp on the specified volume that fills the
 volume up to leave only the percent free value (default is 5%) with ones (FF).
 This allows a storage appliance that is a Solid State Drive to wipe the 
 storage space being erased.
 
.PARAMETER Root
 The folder to create the temporary file in. This can be a drive root (c:\)
 or a mounted folder (m:\mounteddisk).  This must be the root of the mounted
 volume, it cannot be an arbitrary folder within a volume.
 
.PARAMETER PercentFree
 A float representing the percentage of total volume space to leave free.  The
 default is .05 (5%)

.EXAMPLE
 PS> Write-OnesToFreeSpace.ps1 -Root "c:\"
 
 This will create a file of all ones called c:\Trim.tmp that will fill the
 c drive up to 95% of its capacity.
 
.EXAMPLE
 PS> Write-OnesToFreeSpace -Root "c:\MountPoints\Volume1" -PercentFree .1
 
 This will create a file of all ones called
 c:\MountPoints\Volume1\Trim.tmp that will fill up the volume that is
 mounted to c:\MountPoints\Volume1 to 90% of its capacity.

.EXAMPLE
 PS> Get-WmiObject Win32_Volume -filter "drivetype=3" | Write-OnesToFreeSpace
 
 This will get a list of all local disks (type=3) and fill each one up to 95%
 of their capacity with ones.
 
.NOTES
 You must be running as a user that has permissions to write to the root of the
 volume you are running this script against. This requires elevated privileges
 using the default Windows permissions on the C drive.
#>
param(
  [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)]
  [ValidateNotNullOrEmpty()]
  [Alias("Name")]
  $Root,
  [Parameter(Mandatory=$false)]
  [ValidateRange(0,1)]
  $PercentFree =.05
)
process{
  #Convert the $Root value to a valid WMI filter string
  $FixedRoot = ($Root.Trim("\") -replace "\\","\\") + "\\"
  $FileName = "Trim.tmp"
  $FilePath = Join-Path $Root $FileName
  
  #Check and make sure the file doesn't already exist so we don't clobber someone's data
  if( (Test-Path $FilePath) ) {
    Write-Error -Message "The file $FilePath already exists, please delete the file and try again"
  } else {
    #Get a reference to the volume so we can calculate the desired file size later
    $Volume = gwmi win32_volume -filter "name='$FixedRoot'"
    if($Volume) {
      #I have not tested for the optimum IO size ($ArraySize), 64kb is what sdelete.exe uses
      $ArraySize = 64kb
      #Calculate the amount of space to leave on the disk
      $SpaceToLeave = $Volume.Capacity * $PercentFree
      #Calculate the file size needed to leave the desired amount of space
      $FileSize = $Volume.FreeSpace - $SpacetoLeave
      #Create an array of ones (FF) to write to disk
	  $TrimArray = [byte[]] (, 0xFF * $ArraySize)
      
      #Open a file stream to our file 
      $Stream = [io.File]::OpenWrite($FilePath)
      #Start a try/finally block so we don't leak file handles if any exceptions occur
      try {
        #Keep track of how much data we've written to the file
        $CurFileSize = 0
        while($CurFileSize -lt $FileSize) {
          #Write the entire zero array buffer out to the file stream
          $Stream.Write($TrimArray,0, $TrimArray.Length)
          #Increment our file size by the amount of data written to disk
          $CurFileSize += $TrimArray.Length
        }
      } finally {
        #always close our file stream, even if an exception occurred
        if($Stream) {
          $Stream.Close()
        }
        #always delete the file if we created it, even if an exception occurred
        if( (Test-Path $FilePath) ) {
          del $FilePath
        }
      }
    } else {
      Write-Error "Unable to locate a volume mounted at $Root"
    }
  }
}


Run PowerShell with Administrator privileges and execute the script, like:

Write-OnesToFreeSpace.ps1 -root F:

(replace F: with the drive letter assigned to your SanDisk Extreme PRO USB 3.1 Solid State-flashdrive)

SanDisk in 2020 released a newer version of those flashdrives, now called SanDisk Extreme PRO USB 3.2 Solid State-flashdrive(s) with capacities up to 1TB (128GB, 256GGB, 512GB & 1TB), bear in mind the USB 3.2 is just a marketing trick, as examining the specification states it is USB 3.2 Gen1 which still is limited to 5Gb/s. Anyone knows this version still is missing a UASP/TRIM/SecureErase capable controller?

Hope this script helps you like it helped me to restore performance on your SanDisk Extreme PRO USB 3.1 Solid State-flashdrive(s).
Enjoy!


Last edited Dec 20 2020


comments

there are no comments for this post. be the first to post one!


post your comment

 (*) - required
min