News for hackers. Stuff that matters.
Re:Transforming a QLC SSD into an SLC SSD by kasabali on Sunday May 19, 2024 @07:11AM (#40406065)
You don't need to go through all that trouble to use most cheap DRAMless SSDs in pSLC mode. You can simply under-provision them by using only 25-33% capacity.

Most low end DRAMless controllers run in full disk caching mode. In other words, they first write *everything* in pSLC mode until all cells are written, only after there are no cells left they go back and rewrite/group some cells as TLC/QLC to free up some space. And they do it only when necessary, they don't go and do that in background to free up more space.

So, if you simply create a partition 1/3 (for TLC) or 1/4 (for QLC) the size of the disk, make sure the remaining empty space is TRIMMED and never used, it'll be always writing in pSLC mode.

You can verify the SSD you're interested in is running in this mode by searching for a "HD Tune" full drive write benchmark results for it. If The write speed is fast for the first 1/3-1/4 of the drive, then it dips to abysmal speeds for the rest, you can be sure the drive is using the full drive caching mode. As I said, most of these low-end DRAMless Silicon Motion/Phison/Maxion controllers are, but of course the manufacturer might've modified the firmware to use a smaller sized cache (like Crucial did for the test subject BX500).

Re:Transforming a QLC SSD into an SLC SSD by chx on Sunday May 19, 2024 @07:14AM (#40406087)
How do you make sure the empty space is trimmed? Can you trim a portion of a disk?
Re:Transforming a QLC SSD into an SLC SSD by kasabali on Sunday May 19, 2024 @07:19AM (#40406108)
AFAIK Windows runs TRIM when you format a partition. So you can create a dummy partition and format it. Then you can either delete or simply not use it.

On Linux, blkdiscard can be used in the same manner (create a dummy partition and run blkdiscard on it ex. *blkdiscard /dev/sda2).

Re:Transforming a QLC SSD into an SLC SSD by bravetraveler on Sunday May 19, 2024 @07:25AM (#40406139)
If one prefers working with LVM for their devices, that can be a similar wrench. Making/removing a logical volume can do the same

It depends on 'issue_discards' being set in the config

This has drifted over time. I haven't quite rationalized why. Hoping someone can remind me if nothing else, away from a real computer for a bit.

Re:Transforming a QLC SSD into an SLC SSD by rzzzt on Sunday May 19, 2024 @07:43AM (#40406260)
You can go into Properties > Tools > Optimize, the same button that runs defrag on spinning drives runs TRIM on solid state devices.
Re:Transforming a QLC SSD into an SLC SSD by formerly_proven on Sunday May 19, 2024 @08:20AM (#40406444)
Windows by default issues TRIMs basically instantly when deleting a file, and runs "Optimize disk" (which trims all free space) on a schedule by default as well.
Re:Transforming a QLC SSD into an SLC SSD by FooBarWidget on Sunday May 19, 2024 @10:46AM (#40407312)
What about external SSDs over USB? How do you trim those?
Re:Transforming a QLC SSD into an SLC SSD by wtallis on Sunday May 19, 2024 @12:04PM (#40407798)
There are trim-equivalent commands in the ATA, SCSI, and NVMe command sets. So the OS can issue the SCSI command to the USB device that's using UASP, and the bridge chip inside the external SSD can translate that to the ATA or NVMe counterpart before passing it on to the SSD controller behind the bridge. Not all external SSDs or bridge chips actually support trim passthrough, but these days it's standard functionality.
Re:Transforming a QLC SSD into an SLC SSD by FooBarWidget on Sunday May 19, 2024 @02:23PM (#40408765)
I wonder how to do it on macOS then. I have several external SSDs and none of them can be trimmed.
Re:Transforming a QLC SSD into an SLC SSD by wtallis on Sunday May 19, 2024 @02:54PM (#40408961)
https://kb.plugable.com/data-storage/trim-an-ssd-in-macos

Apparently macOS doesn't expose the ability for userspace to manually issue trim commands to block devices (or at least doesn't ship a suitable tool to do so), so the best available workaround is to tell the filesystem layer that it should do automatic trimming even on external drives.

Re:Transforming a QLC SSD into an SLC SSD by ciupicri on Sunday May 19, 2024 @10:49AM (#40407330)
Create a partition that you'll never use and run blkdiscard [1] from util-linux on it.

[1]: https://man7.org/linux/man-pages/man8/blkdiscard.8.html / https://github.com/util-linux/util-linux/blob/master/sys-uti...

Re:Transforming a QLC SSD into an SLC SSD by mananaysiempre on Sunday May 19, 2024 @11:37AM (#40407612)
The literal answer is yes, an ATA TRIM, SCSI UNMAP, or NVMe Deallocate command can cover whatever range on a device you feel like issuing it for. (The device, in turn, can clear all, none, or part of it.) On Linux, blkdiscard accepts the -o, --offset and -l, --length options (in bytes) that map more or less exactly to that. Making a(n unformatted) partition for the empty space and then trimming it is a valid workaround as well.

But you’re most probably doing this on a device with nothing valuable on it, so you should be able to just trim the whole thing and then allocate and format whatever piece of it that you are planning to use.

Re:Transforming a QLC SSD into an SLC SSD by howbadisthat on Sunday May 19, 2024 @10:32AM (#40407222)
What happens if the remaining space is TRIMMED but routinely accessed? (for example by dd, read only)
Re:Transforming a QLC SSD into an SLC SSD by wtallis on Sunday May 19, 2024 @12:00PM (#40407774)
If a logical block address is not mapped to any physical flash memory addresses, then the SSD can return zeros for a read request immediately, without touching the flash.
Re:Transforming a QLC SSD into an SLC SSD by stavros on Sunday May 19, 2024 @02:54PM (#40408959)
Does the mapping happen on first write? Is TRIM then a command that signals the SSD to unmap that block?
Re:Transforming a QLC SSD into an SLC SSD by BeeOnRope on Sunday May 19, 2024 @04:55PM (#40409680)
Yes.
Re:Transforming a QLC SSD into an SLC SSD by Dwedit on Sunday May 19, 2024 @12:38PM (#40408066)
You read zeroes.
Re:Transforming a QLC SSD into an SLC SSD by BeeOnRope on Sunday May 19, 2024 @05:04PM (#40409731)
Not guaranteed by default for NVMe drives. There's an NVMe feature bit for "Read Zero After TRIM" which if set for a drive guarantees this behavior but many drives of interest (2024) do not set this.
Re:Transforming a QLC SSD into an SLC SSD by Dwedit on Sunday May 19, 2024 @06:26PM (#40410214)
Hmmm, when I quick-formatted a drive (which TRIMs the whole thing), then tried reading it back in a disk hex editor, I just saw zeroes.
Re:Transforming a QLC SSD into an SLC SSD by BeeOnRope on Sunday May 19, 2024 @07:41PM (#40410595)
It seems like that would be a likely common behavior for the FTL, but it wasn't guaranteed by the spec, which is why they added this NVMe flag so that you can actually rely on it.
Re:Transforming a QLC SSD into an SLC SSD by halifaxbeard on Sunday May 19, 2024 @12:14PM (#40407891)
:mind-blown:

i knew about "preconditioning" for SSDs when it comes to benchmarking, etc. didn't realize this was the why.

thanks!

Re:Transforming a QLC SSD into an SLC SSD by 1oooqooq on Sunday May 19, 2024 @12:45PM (#40408119)
ssd firmwares are a mistake. they saw how easy it is to sell crap, with non ecc (i.e. bogus ram) being sold as the default and ran (pun intended) with it.

so if under provisioned now they work as pSLC, giving you more data resilience in short term but wasting more write cycles because they're technically writing 1111111 instead of 1. every time. if you fill them up then they have less data resilience.

and the best part, there's no way you can control any of it based on your needs.

Re:Transforming a QLC SSD into an SLC SSD by wtallis on Sunday May 19, 2024 @01:00PM (#40408207)
> giving you more data resilience in short term but wasting more write cycles because they're technically writing 1111111 instead of 1. every time.

No, that's not how it works. SLC caches are used primarily for performance reasons, and they're faster precisely because they aren't doing the equivalent of writing four ones (and especially not seven!?) to a QLC cell.

Re:Transforming a QLC SSD into an SLC SSD by wruza on Sunday May 19, 2024 @02:32PM (#40408826)
Technically they are writing (0,0,0,1) instead of (0.0625).
Re:Transforming a QLC SSD into an SLC SSD by hengheng on Sunday May 19, 2024 @12:47PM (#40408126)
How can I verify that things stay this way?

Partitioning off a small section of the drive feels very 160 GB SCSI "Let's only use the outer sectors".

Re:Transforming a QLC SSD into an SLC SSD by kasabali on Sunday May 19, 2024 @01:59PM (#40408568)
Even keeping the drive always 75% empty would be enough, but partitioning off is the easiest way to make sure it's never exceed 25-33% full (assuming the drive behaves like that in the first place).

To verify the drive uses the all of the drive as a cache, you can run full drive sequential write test (like the one in HD Tune Pro) and analyze the speed graph. If, say, a 480GB drive writes at full speed for the first 120GB, and then the write speed drops for the remaining 360GB, this means the drive is suitable for this kind of use.

I think controllers might've been doing some GC jobs to always keep some amount of cells ready for pSLC use, but it should be a few GBs at most and shouldn't affect the use case depicted here.

Re:Transforming a QLC SSD into an SLC SSD by Dylan16807 on Sunday May 19, 2024 @02:52PM (#40408952)
> Partitioning off a small section of the drive feels very 160 GB SCSI "Let's only use the outer sectors".

In that it was very reliable at accomplishing the goal?

Re:Transforming a QLC SSD into an SLC SSD by bayindirh on Sunday May 19, 2024 @04:17PM (#40409462)
Short stroking bigger disks for higher IOPS and storage speed was a de-facto method in some HPC centers. Do this to a sufficiently large array and you can see unbelievable IOPS numbers for that generation of hardware.
Re:Transforming a QLC SSD into an SLC SSD by userbinator on Sunday May 19, 2024 @03:48PM (#40409304)
That is what an ideal FTL would do if only a fraction of the LBAs are accessed, but as you say some manufacturers will customise the firmware to do otherwise, while this mod basically guarantees that the whole space is used as SLC.
Re:Transforming a QLC SSD into an SLC SSD by ComputerGuru on Monday May 20, 2024 @10:29AM (#40415866)
Scroll down to the section called “SLC CACHING” towards the end of TFA. Your approach will work for only 45GB though the actual SLC cache is 120GB in size, because the process kicks in before the SLC is fully consumed (so it can page on and out of it).

If you don’t need 66% of the drive’s SLC capacity, the small partition approach is indeed easier and safer.

Re:Transforming a QLC SSD into an SLC SSD by kasabali on Wednesday May 22, 2024 @06:22PM (#40447432)
Oh, I've already did. You'll see that if you scroll up and read the last sentence in my comment above.