Data Recovery SD and other devices supporting TRIM
For years, storage devices have posed a challenge when it comes to speed and capacity. With the aim of making them compact and low-powered, especially ideal for laptops and portable devices, electronic industry has come up with an answer: solid-state drives (SSD) for ultra speed, coupled with 2.5″ SMR hard drives for maximum capacity at a friendly price for home and small businesses users respectively. SSDs are recommended as system devices, scratch or temporary storage due to its quick performance; whereas 2.5″ SMR hard drives are perfect for large storages. Both types can be used together to achieve a hybrid system that is both fast and capacious – our article “How to Move the Already Installed Windows from an Old HDD to a New SSD Device and Create a Hybrid Data Storage System” instructs you how this can be done.
In this article, we will explain why it’s so and what to expect when you recover files from a device with the TRIM/UNMAP command, which has a lot of advantages.
Let’s begin by explaining some of their basic principles.
Devices with SSDs
As the main storage device on most computers today, SSDs are faster, run silently, consume less power, and are more shock resistant than conventional hard drives.
SSDs come in two form factors: 2.5″ (the same as conventional HDDs) and M.2, which looks similar to a memory stick.
Two forms of SSD storage devices: 2.5″ (left) and M.2 (right).
In addition to their benefits, such devices also have some serious drawbacks, one of which is the inability to recover files.
Basics of SSDs
As soon as the file is deleted from a mechanical drive, the OS simply marks the disk area as free, but its data remains untouched until another file overwrites it. As soon as a data recovery program accesses the untouched area, it gets the old data. That is how file recovery works.
An SSD must use new cells or take the time to erase the outdated data previously stored. This can be a slow process, therefore when deleting files the OS issues a TRIM command which tells the device not to keep the data. The cells that were occupied by this file are kept in a special pool, waiting for cleaning. When any program or OS attempts to access those cells, all that is sent back is either spurious data or nothing at all.
In addition, the device constantly shuffles data across its cells in order to balance their wear, and it is only the device that knows where the file data is at any given time. In addition to not knowing the actual physical location of the data, the OS does not have any control over this process.
The TRIM command makes data recovery from SSD devices extremely difficult, and in many cases impossible.
In R-Studio, the Features field on the S.M.A.R.T. tab shows whether a flash device supports the TRIM command, as do other flash memory types (SD cards, memory sticks, and similar).
SMR-enabled hard drives
A key obstacle to increasing capacity in compact hard drives is storage density limitations, which is overcome by SMR (Shingled Magnetic Recording) technology. In contrast to conventional hard drives, which write data on non-overlapping magnetic tracks, SMR drives write data on partially overlapping tracks, allowing for a higher track density. Such recordings are called roof shingles because they resemble roof shingles.
This technology does indeed boost hard drive capacity, but when data is written over or deleted, this operation likewise puts a part of the adjoining tracks with pertinent data at risk. To preserve that information, it must be transferred to another area, which can lead to long waiting times. To fast-track this action, the same guidelines utilized in SSDs and the command TRIM are employed. The result with respect to data recovery is analogous: if any program or OS requests information from erased files, the hard drive responds by returning zeros or random characters, making it very difficult or even impossible to recover the information.
A special mark is usually found on the case of SMR disks.
Hard drives with SMR technology support TRIM
TRIM works when all three components are supported: a storage device, an operating system, and a file system on the device that supports it. The TRIM command is supported by almost all modern SSDs and 2.5″ hard drives larger than 1TB. For complex volumes containing SSDs and SMR hard drives, it depends. The Linux LVM2 and Windows software RAIDs both support TRIM, but not most macOS and hardware RAID controllers.
Virtual disks of virtual machines can be a bit more challenging. Despite being stored on a TRIM-supported device, the host OS still sees it as a regular file. The feasibility of running a virtual TRIM-supported disk within the virtual machine depends solely on the type of virtualization software used; some simulate the TRIM command and make no changes to their SSD files while others may effect changes.
TRIM is supported by the following major operating systems and file systems:
When TRIM is issued, TRIM is on/off by default
- The latest version of Windows (7 and higher)
- NTFS and ReFS (Windows Storage Space only) Immediately after deletion
- Mac OS X Lion 10.6.8 and later
- On native Apple SSDs
- Disabled on non-native devices APFS and HFS+ immediately after deletion
- The Linux kernel (2.6.28 and later)
- Ext4, Btrfs, JFS, XFS, F2FS, NTFS Depends on distros and settings. Usually weekly, but may be immediately after deletion.
Data recovery and the TRIM command
Files deleted and disks formatted:
Almost always impossible. Even raw file recovery can’t help.
In Linux, this is possible if done before the TRIM command is run.
Loss of files in slightly damaged file systems (recognized by their native OS):Data recovery is possible if done quickly and on systems without the TRIM command enabled. Every OS gradually repairs such file systems by deleting garbage, invalid record records, and unnecessary data.Those with severely damaged file systems (not recognized by their native operating system). Due to the fact that the OS cannot repair them and doesn’t delete any data, data recovery is possible.
TRIM’s negative effects can be minimized
It is possible to minimize the negative effects of the TRIM command when data recovery is possible. You should disable the TRIM command while recovering data and enable it after it has been recovered.
The Win + X key combination should be pressed.
You will see Windows PowerShell:
Type “fsutil behavior set DisableDeleteNotify 0/1” (1 for disable, 0 for enable)’
Enter “sudo trimforce disable” in Terminal.
Answer several questions with “Y” and enter the administrative password.
TRIM will be disabled when the computer restarts
Enter “sudo trimforce enable” to enable TRIM back.
Depending on the distro and settings, consult the documentation for that installation.
Data recovery from TRIM-supporting devices on a modern OS is nearly impossible for deleted files and formatted devices, and highly difficult in others, when relying on software solutions. Be wary of anyone who insists otherwise, as it’s likely they are either unqualified or deliberately misinforming you. Exceptions occur with a select few sophisticated data recovery companies with certified staff, who may be able to salvage deleted data from an SSD with TRIM on – yet this entails physical device access and intense hands-on investigation.