Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

grahamperrin

macrumors 601
Jun 8, 2007
4,942
648
You don't need to do that. You can just enable TRIM then boot to single user mode and run the command "fsck -fy" and that will TRIM unused blocks on the drive and restore performance.

That seems reasonable, but does a pre-release version of the man page for fsck_hfs mention TRIM?

(I posted, long ago, about some TRIM-related code in open source, but right now I can't recall where that was.)
 

JacquesleMac

macrumors regular
May 24, 2010
106
89
Oxford, UK
This thread is about El Capitan, not Yosemite. The sort of command you mention (trimforce) works in El Capitan. It hasn't been implemented in the Yosemite 10.10.4 latest downloadable beta yet, so, no, it won't work in Yosemite (at least for now).

Thanks for clarifying that. Explains why I was confused...
 
Last edited:

Weaselboy

Moderator
Staff member
Jan 23, 2005
34,137
15,602
California
That seems reasonable, but does a pre-release version of the man page for fsck_hfs mention TRIM?

(I posted, long ago, about some TRIM-related code in open source, but right now I can't recall where that was.)
I have not reviewed the 10.11 documentation, but this has worked I know as far back as Lion, so I assume the functionality will remain in place.
 

crjackson2134

macrumors 601
Mar 6, 2013
4,823
1,948
Charlotte, NC
I couldn't get it to work for me. The command would run just fine, it just no longer reported "Trimmng unused blocks".

Maybe I did it wrong, I'm not sure.
 

crjackson2134

macrumors 601
Mar 6, 2013
4,823
1,948
Charlotte, NC
Just to confirm, TRIM is enabled and you did this from single user mode?

Trim is enabled by turing off SIP and running the trimforce enable command. System profiler reports that it's working.

I then boot into Cappy's single user mode with CMD+S and get a tty screen.

I run the command fsck -fy and it goes through all the normal motions, but never reports "Trimming Unused Blocks"
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
34,137
15,602
California
Trim is enabled by turing off SIP and running the trimforce enable command. System profiler reports that it's working.

I then boot into Cappy's single user mode with CMD+S and get a tty screen.

I run the command fsck -fy and it goes through all the normal motions, but never reports "Trimming Unused Blocks"
Hmm... odd... wonder why it works for BGG and not you.
 

MacsRgr8

macrumors G3
Sep 8, 2002
8,284
1,753
The Netherlands
You don't need to do that. You can just enable TRIM then boot to single user mode and run the command "fsck -fy" and that will TRIM unused blocks on the drive and restore performance.
Does that also work on external (non-boot) SSD drives..?

I have an internal Apple branded SSD as boot volume (native TRIM supported) and an external SSD (Thunderbolt, 2 SSD's in RAID0).
I executed the rootless and enabled TRIM.
The system profiler shows TRIM enabled on the External SSD.

But can fsck -fy in Single User mode "trim unused blocks" of external volumes?
Running fsck_hfs -l /dev/disk3 in Terminal.app normally doesn't do it...
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
34,137
15,602
California
But can fsck -fy in Single User mode "trim unused blocks" of external volumes?
Running fsck_hfs -l /dev/disk3 in Terminal.app normally doesn't do it...

I don't know. Does the fsck command run at all with that command and it just does not TRIM unused blocks, or will the command not execute?
 

MacsRgr8

macrumors G3
Sep 8, 2002
8,284
1,753
The Netherlands
I don't know. Does the fsck command run at all with that command and it just does not TRIM unused blocks, or will the command not execute?
It was easier than I thought...
It is:
fsck_hfs -fy /dev/disk# (# of your disk, no -l option)

See pic:

IMG_3146.jpg
 

grahamperrin

macrumors 601
Jun 8, 2007
4,942
648
… no -l option …

Indeed. Expect fsck_hfs to not perform trimming whilst the file system is mounted; not whilst the file system is locked.

… as far back as Lion …

OK, 10.7. 'Trimming unused blocks' appears in http://www.opensource.apple.com/source/diskdev_cmds/diskdev_cmds-540.1/fsck_hfs.tproj/fsck_msgnums.h for Mac OS X 10.7 but not in http://www.opensource.apple.com/source/diskdev_cmds/diskdev_cmds-491/fsck_hfs.tproj/fsck_msgnums.h

I posted, long ago, about some TRIM-related code in open source

Found, with reference to code that was used for OS X 10.8.1: Does OS X sometimes run a TRIM routine with drives that are not explicitly supported?
 

SlCKB0Y

macrumors 68040
Feb 25, 2012
3,426
555
Sydney, Australia
Don't bother then. Apple has never officially supported non apple hardware and never will.

EDIT: It seems there is an unofficial way of doing it, but it's still a kludge.

How it it unofficial? The utilities are provided by Apple and as of DP2 do not require rootless to be disabled. How is it a kludge? These utilities recognise people were messing with kexts (which is a kludge) and provides an official way to avoid that.

Never supported and never will?? Good job....
 

crjackson2134

macrumors 601
Mar 6, 2013
4,823
1,948
Charlotte, NC
How it it unofficial? The utilities are provided by Apple and as of DP2 do not require rootless to be disabled. How is it a kludge? These utilities recognise people were messing with kexts (which is a kludge) and provides an official way to avoid that.

Never supported and never will?? Good job....

I haven't had a chance to work with DB2 yet. Is the procedure the same only removing the rootless requirement?
i.e. just running the trimforce enable command and rebooting?
 

originalmagneto

macrumors regular
Jun 7, 2015
100
80
Slovakia
If I have a custom Fusion drive enabled (1TB Apple spinner, 240GB SSD), should i run the
fsck_hfs -fy /dev/disk# on the “virtual” Fusion drive or the “regular” SSD drive as seen in the diskutil list?
 

snifferdogx

macrumors member
Apr 12, 2015
73
12
Melbourne, Australia
Ok, all the techno terms are confusing the bejeezus out of me.

Does it look like El Cappy will get a simple feature/button/whatever that will help you switch on TRIM without jumping through hoops and disabling core security features?
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
34,137
15,602
California
Ok, all the techno terms are confusing the bejeezus out of me.

Does it look like El Cappy will get a simple feature/button/whatever that will help you switch on TRIM without jumping through hoops and disabling core security features?
As it stands right now with the latest developer preview version, all you have to do is open Terminal and enter the line below then provide your password when prompted, and you are done.

No security features or anything else need to be bypassed or disabled.

Code:
sudo trimforce enable
 

gmanist1000

macrumors 68030
Sep 22, 2009
2,833
824
Ok, all the techno terms are confusing the bejeezus out of me.

Does it look like El Cappy will get a simple feature/button/whatever that will help you switch on TRIM without jumping through hoops and disabling core security features?

Sounds like a great opportunity for someone to build a simple App that says "TRIM: Enable". They could make a fortune.
 

pnoguchi

macrumors newbie
Jun 28, 2015
5
0
Does that also work on external (non-boot) SSD drives..?

I have an internal Apple branded SSD as boot volume (native TRIM supported) and an external SSD (Thunderbolt, 2 SSD's in RAID0).
I executed the rootless and enabled TRIM.
The system profiler shows TRIM enabled on the External SSD.

But can fsck -fy in Single User mode "trim unused blocks" of external volumes?
Running fsck_hfs -l /dev/disk3 in Terminal.app normally doesn't do it...

I have a similar setup, but actually use the external ssd as a boot drive with 10.11. Using single user mode and running simply fsck -fy does, in fact work on the external drive and does show the "Trimming unused blocks" phrase. When booted from the external SSD the default volume for the fsck -fy command is the boot device, not necessarily the internal SSD.

This is with trim force on, SIP on, Disksensei off. The modified kext is not needed at all in this setup, which is truly neat and sweet;). Disksensei has an interesting Trim page, where it says "Trim has not been enabled, but is working anyway.":D:D:D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.