Force TRIM on device

New to OpenZFS on OS X (Or ZFS in general)? Ask your questions here!

Force TRIM on device

Postby Bingo » Thu Mar 04, 2021 11:29 pm

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!
Bingo
 
Posts: 16
Joined: Thu Mar 04, 2021 11:18 pm

Re: Force TRIM on device

Postby lundman » Fri Mar 12, 2021 2:46 am

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?
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Force TRIM on device

Postby Bingo » Sun Mar 28, 2021 9:34 am

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.
Bingo
 
Posts: 16
Joined: Thu Mar 04, 2021 11:18 pm

Re: Force TRIM on device

Postby Wowfunhappy » Mon May 31, 2021 3:07 pm

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.
Wowfunhappy
 
Posts: 33
Joined: Sat Jul 21, 2018 11:58 am

Re: Force TRIM on device

Postby Sharko » Sun Jun 27, 2021 3:37 pm

@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.
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm


Return to Absolute Beginners Section

Who is online

Users browsing this forum: No registered users and 9 guests