TRIM an SSD after restoring from an image?

1

I just restored a full disk Windows 7 image to an SSD with dd, and am now running off of it.

I'm concerned that the SSD thinks that all of the unused sectors from the image are actually used sectors, because dd wrote data to them.

If so, this dramatically reduces the number of free sectors available to the SSD controller for doing important SSD controller things. I know that Windows "supports" sending TRIM commands to mark sectors as unused, but I suspect it only does this when files are deleted, and that it won't issue TRIM commands pre-emptively for empty sectors on the off chance that the drive doesn't know they're empty.

How do I get Windows to TRIM all the already-empty sectors on the disk? Or where can I find evidence that it will do this itself given time?

interfect

Posted 2017-08-23T04:44:02.080

Reputation: 193

Answers

0

You are correct that normally Windows will only send a TRIM command when a file is deleted, but since the queue for TRIM commands is limited there is also good chance that such TRIM commands get dropped. To address that there is a scheduled background job to perform some additional clean-up, to "retrim" volumes.

That is why the Windows 10 "optimize drives" is set by default scheduled to automatically run at a regular schedule.

For SSD's that will map all currently unused sectors of the selected partition and notify the underlying SSD with the TRIM command that those sectors are no longer needed and can be purged.

You probably won't need to do anything, but if you want to you can manually send the retrim command as well with the -L switch to defrag.exe

optimize drives

HBruijn

Posted 2017-08-23T04:44:02.080

Reputation: 1 024

That would work great for Windows 10, and it looks like Windows 8 has a similar flag, but Windows 7 lacks both "Optimize Drives" and the "-L" switch on its defrag.exe. How do you order a retrim on Windows 7? Do you need third-party software? – interfect – 2017-08-25T01:17:04.207