Page 1 of 1

Force TRIM on device

PostPosted: Thu Mar 04, 2021 11:29 pm
by Bingo
Hello :)

I've been playing around with ZFS on a single 4TB SMR drive because I would like to take advantage of the data checksumming feature in ZFS. I come from Linux where I used btrfs to do the same.

I just have one issue now, which surfaced after I filled the drive to capacity, and subsequently cleared half a terabyte of space. Write speeds have plummeted. As in, the patient appears dead, doctor.

The drive now performs like it does with HFS when it fills above about 6 GB free space. Basically, it doesn't perform any more (with writes - reads are fine). But, with HFS on this type of drive (I have a few of these), I can clear some space, and write speeds recover. I've already used `trimforce enable`, and I assume that macOS/HFS is using TRIM commands on these drives to make them recover.

I created the pool with autotrim on, but it seemed like this didn't kick in. I tried `sudo zpool trim dock`, but it exited with code 255. I then tried `sudo zpool trim dock media-B9F9B73B-D214-1E4B-9790-4C59C42C426B`, but this results in `cannot trim 'media-B9F9B73B-D214-1E4B-9790-4C59C42C426B': trim operations are not supported by this device`.

Is there any way to force this? I don't see any options in `man zpool`. ZFS seems to be my only way to get data checksumming onto this system. Btrfs doesn't do FUSE, and even if APFS eventually gets around to it, I'd have to get a new computer, because this one can't upgrade to the newer macOSes.

Thank you!

Re: Force TRIM on device

PostPosted: Fri Mar 12, 2021 2:46 am
by lundman
When you try trim the first time, it issues a trim command to the device, and if it gets an error, it says not supported. Not barried bugs of course.

What does zpool status -t say?

Re: Force TRIM on device

PostPosted: Sun Mar 28, 2021 9:34 am
by Bingo
Ooops, went Windows instead, then after a week or two of that nonsense, shelved that project entirely. Thinking of retrying with Mac, but that pool is now destroyed. I'll probably have a go at it again, but it'll take awhile. Will report back if I do.

Re: Force TRIM on device

PostPosted: Mon May 31, 2021 3:07 pm
by Wowfunhappy
If it's an SMR drive, that means it's a traditional spinning drive, not an SSD, right?

Pretty sure TRIM is an SSD only feature. HDD's don't need it.

Re: Force TRIM on device

PostPosted: Sun Jun 27, 2021 3:37 pm
by Sharko
@Wowfunhappy: yes, some spinning rust hard drives do indeed support a trim operation. Specifically, shingled magnetic recording drives (SMR drives) often support trim because the data is packed into zones that are much larger than the usual 512 byte or 4kbyte sectors - think megabytes. After a period of use, an SMR drive may have a lot of wasted space in the zones; running trim apparently compacts the data and frees up zones for write operations so that subsequent write operations don't have to do a massive data shuffling operation on the fly, which leads to the experience that the original poster was describing - the drive is barely responsive.