How often do you TRIM?

On Windows the default TRIM schedule for SSDs is weekly, and the Optimize GUI lets you change that to Daily. But is this enough for Chia workloads? We know the creation of a single plot requires about 1.4TiB written. This means that on a fully virgin 1TiB SSD with little overprovisioning, the drive will have to start moving things around even before a single plot is complete, and thus eating into the WAF.

Am I missing something? Or should we schedule TRIM every few hours?

2 Likes

Are you referring to the “optimize drives” (old school defrag) thing?

I think it actually does this kind of work on file delete as well.

You don’t need to worry about executing Trim. Windows will send an instruction to your solid-state drive every time you delete a file. The solid-state drive can then automatically erase that file’s contents.

I haven’t noticed any degradation of perf and I’ve been ignoring this panel for weeks…

I’ve been scheduling retrim just in case.

1 Like

Hmm you bring up a good point though. I ran

Optimize-Volume -DriveLetter D -Analyze -Verbose

and it doesn’t look good :scream:

PS C:\Windows\system32> Optimize-Volume -DriveLetter D -Analyze -Verbose                                                VERBOSE: Invoking analysis on wd black 850 2tb (D:)...                                                                  VERBOSE: Analysis:  0% complete...                                                                                      VERBOSE: Analysis:  1% complete...                                                                                      VERBOSE: Analysis:  2% complete...                                                                                      VERBOSE: Analysis:  100% complete.                                                                                      VERBOSE:
Post Defragmentation Report:
VERBOSE:
 Volume Information:
VERBOSE:   Volume size                 = 1.81 TB
VERBOSE:   Cluster size                = 4 KB
VERBOSE:   Used space                  = 715.46 GB
VERBOSE:   Free space                  = 1.12 TB
VERBOSE:
 Fragmentation:
VERBOSE:   Total fragmented space      = 96%
VERBOSE:   Average fragments per file  = 454.72
VERBOSE:   Movable files and folders   = 672
VERBOSE:   Unmovable files and folders = 4
VERBOSE:
 Files:
VERBOSE:   Fragmented files            = 628
VERBOSE:   Total file fragments        = 303431
VERBOSE:
 Folders:
VERBOSE:   Total folders               = 3
VERBOSE:   Fragmented folders          = 1
VERBOSE:   Total folder fragments      = 17
VERBOSE:
 Free space:
VERBOSE:   Free space count            = 27312
VERBOSE:   Average free space size     = 43.01 MB
VERBOSE:   Largest free space size     = 838.12 GB
VERBOSE:
 Master File Table (MFT):
VERBOSE:   MFT size                    = 7.25 MB
VERBOSE:   MFT record count            = 7423
VERBOSE:   MFT usage                   = 100%
VERBOSE:   Total MFT fragments         = 1
VERBOSE:  Note: File fragments larger than 64MB are not included in the fragmentation statistics.
VERBOSE:
 It is recommended that you defragment this volume.

You shouldnt defrag an SSD drive, it is not a spinning disk.
Defragmentation on an SSD will only cause extra wear and tear.

In a traditional HDD the head has to move across the platters to get the data, it is a physical action. So if the data on the platters is physically closer, it needs less time to get the data and the drive will perform faster.

For SSD the location of the data is irrelevant to the speed.

Why You Shouldn’t Defragment a Solid State Hard Drive (electronicsweekly.com)

2 Likes

Right, the above dialog is smart and does trim on SSDs, and defrag on traditional HDDs. Sorry if that wasn’t clear. You can try it yourself to see.

even if you try to defrag an SSD windows will not do it. It is mapped to noop.

1 Like

Okay, but at the end of your output it states

So to the unexpecting audience, it might seem like it is a good idea to run a old school defragmentation on your SSD :slight_smile:

1 Like

Thanks for the info @yae

1 Like

The Optimize-Volume cmdlet optimizes a volume, performing defragmentation, trim, slab consolidation, and storage tier processing. If no parameter is specified, then the default operation will be performed per the drive type as follows.

HDD, Fixed VHD, Storage Space. -Analyze -Defrag.
Tiered Storage Space. -TierOptimize.
SSD with TRIM support. -Retrim.
Storage Space (Thinly provisioned), SAN Virtual Disk (Thinly provisioned), Dynamic VHD, Differencing VHD. -Analyze -SlabConsolidate -Retrim.
SSD without TRIM support, Removable FAT, Unknown. No operation.

I did go in and change the schedule on mine to do it daily. How often did you schedule yours? Could you post up instructions on how to setup the schedule? (not the optimization schedule for daily, the one you do in scheduler or however you do it)

In some article posted in Reddit, the trimming was considered the most important task for extending the expected life of your SSD.

The guide was following:

This powershell snippet is as follows, and it is run as a scheduled task Once per day, repeating every hour.

$date = (New-TimeSpan -Start (Get-Date “01/01/1970”) -End (Get-Date)).TotalSeconds
Optimize-Volume -DriveLetter D -ReTrim -Verbose > “C:\trimlogs\Trim-D $($date).txt”
Optimize-Volume -DriveLetter E -ReTrim -Verbose > “C:\trimlogs\Trim-E $($date).txt”
Optimize-Volume -DriveLetter Y -ReTrim -Verbose > “C:\trimlogs\Trim-Y $($date).txt”

I have setup the retrim task (windows 10) to run every hour on my main temp drives. I figured it couldn’t hurt.

1 Like

The “defrag and optimize” tool does a TRIM command when run on an SSD

I have mine scheduled for every hour on my temp drive but my OS drive I keep to weekly since it doesn’t get much use. I’m on a lower end system and only do 2 staggered (by 50%) parallel plot operations at a time but after reading the logs (i’m on Linux BTW) trimming every hour for me clears up about 300GiB each time. IMO that’s definitely non an insignificant amount of data and probably helps reduce wear on the flash

I just set up a new task in the Task Manager that schedules “C:\windows\system32\defrag.exe E: /l” every hour (E: is my temp drive)

Trimming every hour delivers me 2 plots/day more then trimming daily equal result on I770K linux NVME as on I4790K windows Intel sata DC3 S4510 SSD So I run defrag d: -L hourly and on linux fstrim -a

1 Like

I just noticed this response. That is nice. Much cleaner than the way I have been doing it. I have been creating a powershell script and then running it with task manager. This single command is much easier. I haven’t verified that it works the same, but looks good via research.

Thank you! This works great, except i used option “/O” (optimize). Not sure if it makes any difference.

You really don’t want to defrag SSDs; tldr it could damage them. Should You Defrag an SSD? | Crucial.com.

Trim is the SSD equivalent: Trim (computing) - Wikipedia and is a great thing to do after every plotting run as it keeps speed up for subsequent plots and keeps your drives healthy.

1 Like