Why is the TRIM function needed and how to enable it - a guide in 6 sections

10/21/2021 windows | for beginners

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

TRIM support for SSDs is enabled by default in Windows 11 and Windows 10, 8.1 and 7 (as are many other SSD optimization features, see SSD setup for Windows 10), however, in some cases this may not be the case. This guide details how to check if the feature is enabled, as well as how to enable TRIM in Windows if the command's support is disabled and additional support for older OSes and external SSDs.

Note: Some materials report that for TRIM to work, the SSD must be in AHCI mode, not IDE. In fact, the IDE emulation mode included in the BIOS/UEFI (namely, IDE emulation is used on modern motherboards) does not interfere with the operation of TRIM, however, in some cases there may be restrictions (may not work on certain IDE controller drivers), moreover , in AHCI mode your drive will run faster, so just in case, make sure that the drive is running in AHCI mode and preferably switch it to this mode, if it is not, see How to enable AHCI mode in Windows 10.

What is TRIM and why should you enable it?

To understand what this option is and why it is needed, you should understand the difference between how different storages overwrite data.

When information is written to the hard drive, the operating system records it in a table located on the HDD. Thanks to this, the OS knows where the clusters in which the information is stored are located.

When a file is erased by the user, the OS removes the data from the table, but the file itself remains. When new data needs to be saved, it is simply written over the old one. With solid state machines everything is different.

Information is recorded in memory cells, so-called. pages. Each of them takes 4 KB. But the data is erased in entire blocks of 512 KB. If the user makes at least some changes to the file, the controller reads the block into the internal buffer, modifies the necessary bytes, erases the block in the cell, finds a place for a new page and writes it there.

Once information is written, it cannot be rewritten until the block is cleared, and since a minimum of 512 KB can be erased, the controller must group and transfer data to free one block.

So users of PCs and laptops with installed solid-state media may experience a decrease in SSD performance over time. After all, previously all information blocks were empty, but now the SSD controller has to completely clean the cells before entering new data there. Because of this, the SSD becomes slower.

In order to rewrite data on the SSD, it is necessary to erase not only the coordinates from the table, but also the file itself from the memory cell. This is where TRIM comes in handy. This command is an option that gives the operating system the ability to tell the SSD which blocks of information are no longer needed and can be erased from the cells.

Recommendation : if you need a fast, durable solid-state drive for games, 860 EVO per terabyte will come in handy. With it, the gameplay will become more comfortable.

It turns out that TRIM is exactly what is needed to maintain the original speed. Modern operating systems add support for this function. When data is erased, the system software sends this command to the SSD. Thanks to this, after receiving a command, the controller immediately clears cells of data that is no longer used. Moreover, this process occurs in the background: during the break between reading and writing information.

Advice : if you need a drive for an OS, then the 256 GB SSD370S Premium is suitable. It writes and reads data quite quickly, and also has a metal body, so it is not afraid of mechanical damage.

All this makes it possible to maintain the original speed of data recording for those cells that are reused.

Seven troubles - one deallocate

Many have heard about the TRIM team. Those same cherished four letters that raise many questions among the average user. TRIM is one of the ATA commands sent by the operating system to notify the solid-state drive that data from the disk has been deleted by the user and occupied physical cells can be freed. It is worth mentioning separately about SSDs with an NVMe interface - these drives have a different set of commands for operation, but an analogue of the ATA TRIM command also exists there - it is called Deallocate and, accordingly, is identical. Therefore, further when we mention TRIM we will also mean Deallocate. Why are we talking about all this? It is precisely the problems with executing these commands that in the vast majority of cases are the reason for the low performance of drives. Of course, we will not leave other problems aside either, but everything has its time.

The moment you delete data from your drive, an entry in the main table of the file system is actually deleted. That is, the data itself remains in place, but the area is marked for deletion. The “cleaning of cells” itself occurs at a certain time, for example, when the drive is idle while you go for tea. In this way, manufacturers achieve reduced memory wear and increase the performance of their drives in certain scenarios. The controller is responsible for cleaning these cells by executing the TRIM command. By the way, after its execution, data recovery is almost impossible.

Just recently we

talked about Secure Erase technology

, which is similar to TRIM, but affects not only the main cells, but also service areas, returning the drive to its completely original state. Let us remind you that Secure Erase can be performed on a drive only without a file system and under certain conditions. And TRIM technology precisely requires an operating system with all the attendant requirements.

How to check if TRIM function is enabled?

You can check whether this function is enabled on a PC with an installed SSD using the command line. This must be done on behalf of the administrator.

Note : the check is considered using the example of devices with Windows. But in Linux everything looks similar.

How to do:

  1. Activate the line through Start by entering standard programs. Click on the command call using the right button of the computer mouse or touchpad (RMB) and launch the command line with administrator rights by selecting the appropriate item.
  2. When the field the user needs opens, you will need to enter: fsutil behavior query disabledeletenotify and click to confirm execution.

If it displays:

  • disabledeletenotify=1 — TRIM is not activated;
  • fsutil behavior set disabledeletenotify 0 - enabled.

How to enable TRIM function in Windows 7, 8, 10?

To activate the command, you need to make sure that the disk controller is running in AHCI mode. It allows you to use all the advantages of a SATA connection. You can check whether this mode is active through the BIOS and Device Manager.

Usually it is already activated. But if the user sees that it is not, he can enable the option manually. However, it happens that the operating system simply does not see the SSD. To find out if this is the case and, if necessary, to “open her eyes”, you will need to perform several simple steps described in the table.

Check if the OS sees the disk correctly?1. Go to the properties of the installed solid-state drive by right-clicking on it.
2. Log in to the Service.
3. Enable optimization.
4. Go to the next window and see what the Media Type shows. If there is not a solid-state drive, but a regular hard drive, then the system does not know that the computer has an SSD. That's why TRIM is turned off.
How to help the operating system correctly recognize the disk type1. Run the command line as an administrator.
2. Enter: winsat diskformal.
The system will run a speed test. Once it's finished, you can check again to see if it sees the SSD. If yes, you can check if TRIM support is enabled by following the steps described in the previous section. Most likely, support will be enabled.
If the system correctly detects the disk as an SSD, but TRIM does not work1. Run a command line as administrator.
2. Enter: fsutil behavior set disabledeletenotify ReFS 0. This will enable TRIM for ReFS.

Useful: TOP 10 SSD drive manufacturers

Additional Information

Finally, some additional information that you may find useful.

  • Today, external solid-state drives have appeared and the question of enabling TRIM sometimes concerns them too. In most cases, TRIM cannot be enabled for external SSDs connected via USB, because This is a SATA command that is not transmitted over USB (but there is information online about separate USB controllers for external drives that support TRIM). For SSDs connected via Thunderbolt, TRIM support is possible (depending on the specific drive).
  • Windows XP and Windows Vista do not have built-in support for TRIM, but it can be enabled using Intel SSD Toolbox (older versions, specifically for these operating systems), older versions of Samsung Magician (you need to manually enable performance optimization in the program) with XP/Vista support, also There is a way to enable TRIM using the 0&0 Defrag program (search the Internet specifically in the context of your OS version).

How to enable TRIM feature in Linux?

For the function to work on Linux, a file system such as ext4 is required. So, to activate TRIM for SSD on a Linux computer, you need to:

  • Mark in discard - the option that is intended for mounting partitions - ext4 in fstab.
  • Also, for a partition on a solid-state drive, you must also enable noatime or realtime and nodiratime: they are needed to reduce the write load. Please note that then access dates for all kinds of folders and files will not be updated.

  • For owners of PCs that are connected via a UPS, or owners of laptops, the commit function with a certain temporary value, for example, 1 minute, will be useful: this function will postpone all recording processes. Operations will be performed once per minute per partition.

It turns out that the fstab line will look like this: UUID=aeade6fd-2b24-4e59-bc8c / ext4 noatime,discard,errors=remount-ro,commit=60 0 1.

You can also run TRIM manually by applying it to the root file system by typing sudo fstrim / -v.

Curious: TOP 10 best SSDs for 120-128 GB

RAID1 mirroring

With the advent of SSD, lifespan and performance are two very important things to consider for it. At a time when Apple is increasingly equipping its computers with solid-state drives, or what they call flash memory, in some cases it is worth reconsidering the TRIM command. It limits wear and loss of performance over time.

The team is rarely supported externally. USB 2.0, USB 3.0 UASP and FireWire do not support control, while eSATA cameras are compatible with most Thunderbolt cameras. The reason is simple - Thunderbolt cases include a standard SATA controller that uses standard OS X drivers, so they use the command.

For RAID enthusiasts, the command works in RAID1 mirroring and RAID0 deletion when using Mac OS X software, while cards that use a hardware RAID controller generally do not take this command into account.

How to enable TRIM on an NTFS partition?

Those who work with PCs and laptops running Microsoft OS do not need to do anything: the maximum is to find out whether TRIM is active. If yes, then the command will be automatically sent during actions with the SSD such as:

  • file cleaning;
  • deleting, as well as completely formatting partitions that belong to NTFS - a more modern file system than FAT32.

Important! The command only works with the NTFS file system.

In eight and ten, you can enable TRIM for the entire section. To do this, you will need to start defragmentation by going to the Service. After this, the command will work for all empty cells that are on the SSD: the entire free partition of the drive, which is marked in NTFS, is “trimmed”.

In the same way, in the seven and later versions of the OS, you can activate the function for the entire NTFS partition. To do this, the user will need to clear it through quick formatting. However, you should remember that all data from the partition will disappear. The commands to activate the function are shown in the picture.

For computers and laptops that run on Linux, you can also do this. But you will need ntfs-3g drivers. They should be released no earlier than 2015. They added the TRIM option. To enable this option, you just need to command: fstrim -v /media/ntfs/.

Useful: How to check the status of an SSD drive in Windows and Mac - 10 programs for monitoring

SSD Upgrade Process

SSD stands for Solid State Drive. Or, as they also say, a solid-state block. It consists of smaller blocks, and these, in turn, are divided into pages. It is not a hard drive. It doesn't have any disks inside. It can be compared to read-only memory, or rather a USB flash drive.

It retains one of the speed errors that is comparable on the current PC. The SSD has seen an impressive reduction in speed and power after several upgrades. They don't understand NTFS, FAT, EXT4 or any file system used by the OS. For this reason, when a file was marked deleted, the cell remained "locked".

Hard drives aren't perfect either. Based on physical parts, they tend to increase the rotation speed to achieve higher speeds. This causes overheating, which is not good for any electronic component.

In addition to their rotation limit, they are also susceptible to vibration and shock. SSD does not have these disadvantages, and in the future the manufacturer promises users excellent data access speeds, almost instantaneous. All of this can be achieved using the acronym TRIM.

Rating
( 1 rating, average 4 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]