Raising SSD performance from knees, where to press and why. Does TRIM or Deallocate work in your SSD? Refs file system for windows 10

Today we will talk about the so-called TRIM function and its relationship with solid state drives SSD.

The TRIM function is needed to avoid performance degradation in, and has appeared since the version of Windows 7. Now I will explain in more detail about how TRIM works and how to check if it is enabled on a computer.

What is TRIM?

First, let's figure out the HDD (normal hDD with moving parts). Most file systems are now developed specifically for HDD and there is the following type of data processing: we have a file that we decided to write to the hard disk, the system writes data about the file to a cluster stored on the disk, and the coordinates of this file are recorded in an address table called MFT (Master File Table). To access this data, the system takes coordinates from the MFT. When we delete a file, the data from the MFT is deleted, but not deleted from the cell (cluster). After we decided to write other files to disk, maybe new ones, then the data is written to cells over the deleted ones.

This type of recording to a drive is in no way suitable for SSDs, since they are developed using a different technology. The drives use flash memory and writing data over deleted data is not allowed here. In other words, unnecessary actions would be performed that would load the SSD drive: first, data is copied from the cluster to the cache, then the cluster is cleared, and new information is written over the old one. If there is nothing in the cell, that is, it is empty, then only recording occurs. It is clear that when writing information to an empty cell, this happens many times faster than unnecessary actions, such as rewriting and replacing old data. Under these circumstances, the SSD drive would lose its original speed.

Fortunately, we have TRIM technology that solves this problem. In simple words, as soon as the data from the MFT is erased, they will be deleted from the cells, and then new data will be written.

By the way, there are also old SSD drives that do not support TRIM, they just were created for old operating systems that did not have this function.

For TRIM to work, the following conditions are required:

  • Availability of drives that support TRIM;
  • OS that supports TRIM. It is in Windows 7;

You also need to have the Microsoft Storage driver installed, but it usually installs automatically if, of course, the SATA controller supports AHCI mode. Also TRIM will not work if the function is active and if you are using.

TRIM works not only on Windows but also on Linux. Kernel version 2.6.33 or higher is required.

To check the activity of the AHCI mode for the SATA controller, you need to go to the device manager and expand the tab "IDE ATA / ATAPI Controllers", or something similar.

How can I check if the TRIM function is enabled, and if not, how to enable it?

First, we'll check if this function is active. We open command line as administrator and enter the command there:

fsutil behavior query DisableDeleteNotify


If the value is 0, then the TRIM function is enabled, and if 1, then it is disabled.

Turning on the TRIM function?

Yes, everything is very simple here, we again open the command line as administrator and enter the following command:

fsutil behavior query | set DisableDeleteNotify \u003d 0

Now you can check the function again.

I think that this article can end, if you have an SSD drive, then it is good to know the definition of TRIM, especially before purchasing a drive, you must make sure that this function is supported, otherwise the life of the drive without it will drastically decrease, and the speed will be so yourself.

The TRIM command is essential for maintaining the performance of SSD drives over the life of their drives. The essence of the command boils down to clearing data from unused memory cells so that further write operations are performed at the same speed without first deleting existing data (if the user simply deletes data, the cells are simply marked as unused, but remain filled with data).

SSD TRIM support is enabled by default in Windows 10, 8, and Windows 7 (like many other SSD optimization features, see), however, in some cases this may not be the case. This instruction details how to check if the feature is enabled, as well as how to enable TRIM in Windows if command support is disabled and additional, concerning older OS and external SSDs.

As noted at the beginning of the tutorial, by default, TRIM support should be enabled for SSDs automatically in modern operating systems. If you have it disabled, then before enabling TRIM manually, I recommend doing the following (your system may not "know" that an SSD is connected):

If the disk type is detected correctly, then the TRIM options can be set manually using the command line launched as administrator with the following commands


With a similar command, setting the value to 1 instead of 0, you can disable TRIM support.

Additional Information

Finally, some additional information that you may find useful.

  • To date, external solid-state drives have appeared and the question of enabling TRIM sometimes applies to them as well. In most cases, TRIM cannot be enabled for external SSDs connected via USB. this is a SATA command that is not transmitted over USB (but there is information on the network about individual uSB controllers for external storage with TRIM support). For Thunderbolt SSDs, TRIM support is possible (depending on the specific drive).
  • On Windows XP and Windows Vista there is no built-in TRIM support, but it can be enabled using Intel SSD Toolbox (older versions, specifically for the specified OS), older versions of Samsung Magician (you need to manually enable performance optimization in the program) with XP / Vista support, there is also a way to enable TRIM using 0 & 0 Defrag programs (search the Internet in the context of your OS version).

This article describes the ATA TRIM command, which is used to increase the write speed of SSD drives.

The use of the ATA TRIM command does not happen automatically in all cases; in some situations, the execution of this command from the OS side must be enabled explicitly.

First, you need to make sure that your SSD drive supports this command. However, all new discs support it. Such a check can be done with any modern program for working with disks. For example on Linux this can be done with console command:

hdparm -I / dev / sda | grep -i trim

Where sda your SSD drive. The command output should contain the line "TRIM supported".

How TRIM works

One of the main functions of any file system is to store a list of disk sectors in which a particular file is written. That is, a list of disk sectors is associated with each file.

When you delete a file on an SSD drive, the operating system sends a TRIM command to the SSD controller along with a list of sectors that can be cleared. The controller writes these sectors to the queue of its garbage collector routine. And this subroutine processes all sectors from the list.

The garbage collector works when the disk is idle. That is, when the operating system does not send requests to read or write data. Therefore, it takes some time from the moment the TRIM command is received until the actual deletion of these sectors.

If there are many sectors in the trimerization queue, clearing them may take a long time. For example, if you do a quick formatting of an entire partition, then TRIM of this size can be lengthy.

However, there is no need to sit and wait for the process to end. Even if the disk is turned off, queue processing will resume after it is turned on.

When TRIM doesn't work!

  • TRIM function does not work if the SSD is connected via USB.
  • TRIM does not work for FAT32 partitions.
  • The TRIM function does not work yet for a large number of file systems (eg Ext2).
  • The TRIM feature does not work when you delete an entire partition, even if the file system supports TRIM and this option is enabled.

When TRIM should work

  • Linux with kernel 2.6.33 and Ext4 file system.
  • Windows 7, 8 and 10 and NTFS file system.

In either of these options, the TRIM command is sent only after files have been deleted. Or separately, forcibly for all free space, if the OS supports this option.

Enabling TRIM on Linux

Note... In Ubuntu, starting from version 14.04, you do not need to do anything else. Everything works out of the box.

First, to use TRIM, the filesystem must be ext4.

Second, the TRIM command is enabled in the mount option for the ext4 partition in the fstab file. Specifically, this is an option discard.

In addition, for a partition on an SSD disk, you can add the noatime (or realtime) and nodiratime options - this is a decrease in the write load, the access dates for files and folders will not be updated.

You can also add the commit option and specify a value of allowable 60 seconds - pending write operations will be performed per section every 60 seconds. But this option can be added only if you have a UPS (UPS), or on a laptop!

Thus, the example line fstab might look like this:

UUID \u003d aeade6fd-2b24-4e59-bc8c / ext4 noatime, discard, errors \u003d remount-ro, commit \u003d 60 0 1

On Linux, you can run the TRIM command and manually:

sudo fstrim / -v

This example applies the command to the root filesystem. If there are multiple ext4 partitions, then such a command must be executed for each such partition.

Check and enable TRIM on Windows 7, 8, or 10

First you need to open the console ("Command Prompt") with administrator rights. Start menu - Programs - Accessories - Command line. Right button mouse - Run as Administrator.

fsutil behavior query disabledeletenotify

If the command output is - disabledeletenotify \u003d 1, then the TRIM command is disabled. You can enable it with the command:

fsutil behavior set disabledeletenotify 0

Don't mix it up! Zero - TRIM on, one - TRIM off.

How to TRIM on NTFS Partition

If your operating system is Windows 7, 8 or 10, then you can do nothing. It is enough to check whether the TRIM function is enabled. Then Windows will automatically send the TRIM command for the following disk operations:

  • Delete file (s).
  • Fast formatting of NTFS partition (disk).

On Windows 8 and 10, you can manually TRIM an entire NTFS partition (disk). In the properties of the disk, on the "Service" tab, you need to open the Disk Optimizer. This is the new name for Windows Defragmenter.

The "Optimize Disk" command will be available in the Disk Optimizer for NTFS partitions on an SSD disk. This command causes Windows to send a TRIM command to the SSD drive for all free blocks on that drive. That is, all free space on the NTFS partition (disk) is "trimmed".

In Windows 7, 8 and 10, you can "trim" the entire NTFS partition (disk). To do this, you need to quickly format this partition (disk). However, it is important to understand that this will destroy all data on the partition.

In the latest (2015, 2016) versions of the ntfs-3g driver (ntfs driver for linux), the TRIM function has been added. Now you can "trim" the NTFS partition from Linux. Command in terminal:

fstrim -v / media / ntfs /

where / media / ntfs / is a mounted NTFS partition.

How to TRIM on Windows XP and Vista

Neither Windows XP nor Vista supports TRIM. If you need to "trim" the SSD drive that is used in these operating systems, then there are the following options:

What is TRIM (garbage collection)

Have SSD drives there is an important difference from HDD that affects the recording speed. In HDD, recording is performed "over" old data. Disk blocks that previously contained data and then this data was deleted are simply marked as free. And when it is necessary to perform recording, the HDD controller immediately writes to these free blocks.

When using flash memory, blocks that previously contained some information must be cleared before writing. This leads to the fact that when writing to previously used blocks, the write speed drops significantly, because the controller needs to prepare them for writing (clear).

The problem is that operating systems traditionally do not work with the file system in such a way that when files are deleted, the contents of blocks on the disk are cleared. After all, on hDD disks it was not necessary.

Therefore, when using SSD drives, there is a "performance degradation" effect. When the disk is new and all blocks of flash memory are clean then the write speed is very high, according to the passport. But after the disk is completely full and after that some of the files are deleted, rewriting will occur at a lower speed. Due to the fact that the disk controller will have to clear the blocks of flash memory before writing new data there.

The drop in write speed to reusable blocks of flash memory can be very high. Up to values \u200b\u200bclose to the recording speed of HDD disks. When testing SSD drives, they often even conduct a special test to reduce the write speed to reusable blocks.

To combat this phenomenon, the disk ATA TRIM command has been added to new operating systems. The file system driver sends a TRIM command to the SSD controller when deleting a file. At this command, the SSD disk controller flushes the freed blocks of flash memory, but does so in the background, between reads and writes.

Using this command returns the full write rate for reusable blocks of flash memory. However, not all operating systems support this command. But only relatively recent versions:

  • Linux kernel since version 2.6.33.
  • Windows 7, 8 and 10
  • Mac OS X starting from version 10.6.6 (but for this version you need to install an update).

Until now, the popular Windows XP (like Vista) does not support this command.

A workaround for older operating systems is to use third-party programs. For example, it can be hdparm (version 9.17 and higher) or proprietary programs of the SSD manufacturer, for example Intel SSD Toolbox.

There are two models of SSD drives in which the degradation of the speed of reused blocks is less pronounced than that of others:

  • Plextor M5 pro (discontinued).
  • Plextor M5S (discontinued)
  • Intel 545s
  • Samsung 860 EVO

The firmware (firmware) of such disks can partially clear unused blocks without the TRIM command. Recovering write speed to full rated write speed.

In 2019, many SSD models are able to "collect garbage" on their own. More precisely by specific model can be found by reading the test reviews. In serious Internet publications, among other tests, they also test the ability of a disk to independently clear blocks.

TRIM command may not work if SATA controller motherboard was set to IDE mode (for compatibility with older OS or program).

TRIM is most often disabled when using a RAID array.

Deleted data recovery

If you are using TRIM, about recovery deleted files you can forget. If you delete a file, its data on the SSD will be destroyed.

Impact of TRIM on write speed

It is important to understand that using or not using the TRIM function does not directly affect the write speed of an SSD drive. Only one factor affects this speed - the presence of a sufficient number of free blocks of flash memory. That is, such blocks that are cleared by the disk controller and are ready to write new data to them.

In other words, the write speed depends on the amount of free disk space. If your disk is almost full, the write speed will drop even if you use TRIM. Conversely, if you have 20-30% of the disk capacity left unallocated disk space, then you can do without using TRIM. The disk controller will use unused space for partitions to equalize write speeds.

But when reserving free space, it is important to understand that this must be done on a new SSD drive before using it. If you delete an already existing section. Or reduce the size of the existing size, the blocks of flash memory occupied by this partition will not be cleared. They will remain occupied until you use that free space again.

If you want to reserve free space on a fully partitioned SSD disk, then you need to execute the forced TRIM command for the entire partition and only then delete the partition (or reduce its size).

Utilities Some manufacturers, such as Samsung Magician, allow you to allocate a portion of the SSD disk capacity for use by the disk controller (write cache and wear leveling). In this case, such an allocated space will not be available for operating systems - they will "see" less disk capacity.

First in Windows Server, and now Windows 10 has a modern file system REFS (Resilient File System) where you can format hard drives computer or system-created disk spaces.

This article is about what the REFS file system is, how it differs from NTFS and possible uses for the average home user.

In addition to the functions related to maintaining the integrity of data on disks, REFS has the following main differences from the NTFS file system:

  • Usually more high performanceespecially in the case of using disk spaces.
  • The theoretical volume size is 262,144 exabytes (versus 16 for NTFS).
  • No file path limit of 255 characters (REFS - 32768 characters).
  • Names are not supported in REFS dOS files (i.e. access the folder C: \\ Program Files \\ along the way C: \\ progra ~ 1 \\ it will not work). NTFS retained this feature for compatibility with older software.
  • REFS does not support compression, additional attributes, encryption by means of the file system (NTFS has it, it works for REFS).

Can't format at this time system disk in REFS, the function is available only for non-system drives (not supported for removable drives), as well as for disk spaces, and, perhaps, only the latter option can be really useful for an ordinary user who is worried about data safety.

Please note that after formatting the disk in the REFS file system, part of the space on it will be immediately occupied by control data: for example, for blank disk 10 GB is about 700 MB.

Perhaps in the future, REFS could become the main file system in Windows, but at the moment this has not happened. Official information on the file system on the Microsoft website:

TRIM is an important function (command) that can significantly extend the service life solid state drive SSD. If the TRIM function is enabled and working, then when files are deleted from the SSD, data is completely cleared from unused memory cells. When the user simply deletes data, the cells are simply marked as unused, but in fact remain full.

Typically, TRIM support for SSDs is enabled by default on Windows operating systems (including Windows 7/8/10). But sometimes it happens that, for one reason or another, this option may not be activated. Therefore, to maintain performance and extend the life of your SSD, it is still best to check if the TRIM feature is working.

How to do this, as well as how to enable TRIM in Windows, if the function does not work, read this quick guide.

How to check if the TRIM command is enabled (for example, Windows 10)


In our example (see the screenshot above) from the received report it follows that the TRIM command is enabled and used - the value 0 opposite NTFS DisableDeleteNotify.

If the number was "1", it would mean that the TRIM command is disabled.

How to enable TRIM on Windows 10, 8 and Windows 7

If TRIM is disabled, when using SSD storage, it is highly recommended to activate it.

Method one:


Second way:

If the media type is determined correctly in "Disk Optimization", but in fact TRIM support is disabled, then the TRIM command can also be enabled in manual mode:


How to disable TRIM

If you want to disable TRIM support, then:

  • Run command windows string on behalf of the administrator;
  • Run the command fsutil behavior set disabledeletenotify NTFS 1 .

Conclusion

All of the above applies to operational windows systems 10, 8 and Windows 7, where TRIM support usually works by default, however, in some cases user interaction is still required to enable this option. As for the old operating systems from Microsoft (Windows XP and Vista), there is no built-in TRIM support, however, it can be enabled using various programs, for example, older versions of Samsung Magician, Intel SSD Toolbox, etc.