TRIM on third party SSD

Discussion in 'OS X Yosemite (10.10)' started by Rockadile, Apr 25, 2015.

  1. Rockadile macrumors regular

    Joined:
    Jun 11, 2012
    #1
    I have installed a 850 Evo and upgraded to Yosemite than realized TRIM can't be enabled without disabling kext.

    I'm reading conflicting posts on whether it's necessary.
    Apparently sandforce controllers has a form of it's own TRIM? Not sure about Samsung MGX.
     
  2. olletsocmit macrumors 6502

    olletsocmit

    Joined:
    Jun 24, 2010
    Location:
    USA
    #2
  3. Rockadile thread starter macrumors regular

    Joined:
    Jun 11, 2012
    #3
  4. olletsocmit macrumors 6502

    olletsocmit

    Joined:
    Jun 24, 2010
    Location:
    USA
    #4
    I am not sure what kext signing is. Can u explain what it is to me. Does the app I am using disable it?
     
  5. Rockadile thread starter macrumors regular

    Joined:
    Jun 11, 2012
    #5
    The link I posted explains it in plain English. I don't think I'll be able to simplify it more ;)
     
  6. SaSaSushi macrumors 68040

    SaSaSushi

    Joined:
    Aug 8, 2007
    Location:
    Takamatsu, Japan
    #6
    Garage collection is not the same as TRIM. I highly recommend enabling TRIM (and disabling KEXT signing) for the best performance over time.

    I have been booting from a 500GB Samsung 840 EVO in a Delock 42490 TB enclosure for a year and a half now starting and have had zero issues.

    I am currently using Yosemite. See here for another useful article on the issue.
     
  7. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #7
    That is up to you. Worst thing that could happen at this point, to my knowledge, is that your system reenables kext signing and prevents you from booting as long as the Trim Enabler hack is in place. In that case the website you linked has a solution and if that doesn’t work you can still reinstall OS X from recovery without losing your files. You just have to remember to disable it whenever you update your system and when you reset the NVRAM manually.
     
  8. crjackson2134 macrumors 68020

    crjackson2134

    Joined:
    Mar 6, 2013
    Location:
    Charlotte, NC
    #8
    Actually, I've been using TrimEnabler for a very long time and it works well. I've done many OS updates, PRAM resets etc... It's never given the failed boot issue. The only perceived problem was that I once tried to disable it prior to an OS update (as recommend) but I couldn't disable it. It threw a messege stating the it couldn't be disabled because there was no longer a backup file. I ignored it, installed the update and rebooted without a problem.

    Since then, I've updated my SSD to an Apple PCIe blade, so Trim isn't an issue for the boot drive anymore.
     
  9. tiamo macrumors newbie

    Joined:
    Jul 8, 2010
    #9
    a little about trim

    if you can access your ssd's firmware, you can modify the IDENTIFY DEVICE DATA to return a model number starting with "APPLE SSD", then trim will be enabled by default.
     

    Attached Files:

  10. That-Guy macrumors 6502a

    That-Guy

    Joined:
    Feb 25, 2012
    Location:
    UK
    #10
    Is this possible with Samsung 840/850 SSDs?

    This would be so much easier in the long run.
     
  11. mikeboss, May 25, 2015
    Last edited: May 25, 2015

    mikeboss macrumors 65816

    mikeboss

    Joined:
    Aug 13, 2009
    Location:
    switzerland
    #11
    holy cow, tiamo strikes again :cool:

    I had once a look at the firmware/updater of the Plextor but couldn't find where or how I can edit the DEVICE IDENTIFIER STRING... same with the SAMSUNG. so, tiamo, could you please share a little bit more about how this can be done?

    EDIT:
    hm. looking at the windows screenshot you were using arcconf.exe? is it possible to use this utility without an ADAPTEC HBA? the command would be "arcconf IMAGEUPDATE"? how to get ahold of the SSD's firmware?

    thnx!
     
  12. Pieterr macrumors regular

    Joined:
    Mar 22, 2015
    Location:
    The Netherlands
    #12
    This is exactly what TrimEnabler does for you... :cool:
     
  13. mikeboss, May 25, 2015
    Last edited: May 25, 2015

    mikeboss macrumors 65816

    mikeboss

    Joined:
    Aug 13, 2009
    Location:
    switzerland
    #13
    wrong! this is absolutely not the case! trim enabler manipulates /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage so it will support TRIM on ANY brand/model SSD. manipulating the SSD's firmware is a quite different approach. no need to fiddle with boot args or editing OS X's KEXTs.
     
  14. donlab macrumors 6502

    donlab

    Joined:
    Jun 3, 2004
    Location:
    USA
    #14
    Some people insist that TRIM is necessary while others don't. For me, I prefer not to disable a security feature. (In b4 the naysayers "where was this security feature in mavericks") My Evo 840 is already blazing fast without trim that I don't think I will discern the difference. What I did was shrink my OS partition size by 9% of the total capacity. This space will be available to SSD for its internal garbage collection. Your partition will appear completely full to the SSD since there is no trim, but SSD still has space to rearrange data on its own.
     
  15. Pieterr macrumors regular

    Joined:
    Mar 22, 2015
    Location:
    The Netherlands
    #15
    Exactly. I've been using SSDs for several years without ever enabling Trim.
     
  16. PeterHolbrook macrumors 6502a

    Joined:
    Sep 23, 2009
    #16
    Can Samsung Magician 4.6 modify that data? Supposedly, it will only read Samsung SSD's, but can it write modified firmware updates to Samsung SSD's that identify themselves as APPLESSD? If the regular Samsung Magician 4.6 can't do this, can it be successfully modified so that the updated firmware will identify itself as APPLESDD?

    If Samsung Magician won't do the job, can you suggest any other DOS/Windows/Linux/OS X piece of software that will both backup the original firmware of an SSD and then write a Hex-edited version (identifying itself as APPLESSD) back to the drive?
     
  17. b0fh666 macrumors 6502a

    b0fh666

    Joined:
    Oct 12, 2012
    Location:
    south
    #17
    kext signing is probably the first step in the world domination plans of evil appel corp, soon OSX will be the same [censored] as IOS, no downgrades, no dirty code running, only sanitized and appel-corporate approved code, etc.

    I think it was optional in mav, default in yosumfinky, nonexistent before, and probably mandatory on the next release or the one after.

    disable that thing without remorse man. TRIM is important.

    cheers
     
  18. Freyqq macrumors 68040

    Joined:
    Dec 13, 2004
    #18
  19. tiamo macrumors newbie

    Joined:
    Jul 8, 2010
    #19
    the arcconf is a helper program written by myself to flash the ssd attached to my adaptec raid card, it is not the official command line tools made by adaptec.

    the firmware in plextor ssd has a simple structure.
    the firmware is divided into two regions, boot code and user code,and user code is also divided into more small parts called as BIN.
    boot code, user code, BIN contain a header followed by payload data and one byte payload checksum.

    the header's length is 0x20
    the first uint32 should be a fixed value 0x5a
    the second uint32 is the total length
    the third uint32 is the payload data length
    after payload data, there is a one byte checksum, so the total length=payload_lenth+1
    the last byte of header is the header's checksum
    checksum is computed by summing the whole payload data byte by byte.

    there is also a total code length uint32(both boot and user code) and an uint16 user code checksum at the end of the firmware. the checksum counts only user code(boot code is not included)

    if you have a decrypted firmware file(yes, plextor encrypted the firmware in his firmware updater tools), you can see something like this

    offset 0x0000-0x2000 is boot code
    offset 0x2000-0xxxxxx is user code
    AND offset 0x2060-0x2088 is the raw ATA model string returned by IDENTFY DEVICE command. we need modify this! but wait, remember the CHECKSUM.
    offset 0x3fff8-ox3fffc is the total length of both boot and user code, and 0x3fffe is the user code's checksum.(total length of the firmware is 256kb)

    --------- my m5p dump-------(for example)
    first is the boot code
    Code:
    00000000 5A 00 00 00 0D 1C 00 00 0C 1C 00 00 20 00 00 00 Z........... ...
    00000010 00 E0 01 00 00 E0 01 00 00 00 00 00 00 00 00 8D ................
    
    then the user code
    Code:
    00002000 5A 00 00 00 49 01 00 00 48 01 00 00 20 20 00 00 Z...I...H...  ..
    00002010 00 00 00 04 00 00 00 04 00 00 00 00 00 00 00 35 ...............5
    00002020 73 73 64 62 69 6E 76 32 4C 49 54 45 4F 4E 20 4C ssdbinv2LITEON L
    00002030 43 53 31 32 38 4D 36 53 00 00 00 00 00 00 00 00 CS128M6S........
    00002040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    00002050 44 43 37 30 32 30 47 20 01 02 00 00 00 00 00 00 DC7020G ........
    00002060 50 41 4C 50 20 45 53 53 20 44 50 28 45 4C 54 58 PALP ESS DP(ELTX
    00002070 52 4F 50 20 2D 58 32 31 4D 38 50 35 6F 72 20 29 ROP -X21M8P5or )
    00002080 20 20 20 20 20 20 20 20 2E 31 38 30 20 20 20 20         .180    
    
    looking at 0x2008, the length is 0x148(LE32), this is the first BIN in user code region

    Code:
    00002160 10 10 12 10 13 10 22 10 CA 5A 00 00 00 79 EC 01 ......"..Z...y..
    00002170 00 78 EC 01 00 89 21 00 00 00 00 00 40 00 00 00 .x....!.....@...
    00002180 40 00 00 00 00 00 00 00 4F                      @.......O       
    
    from 0x2020 to 0x2167(length 0x148) is the payload data, and 0x2168 is checksum(sum of those bytes in [0x2020, 0x2167], 0x148 bytes), yes, we need modify this byte too. and there is another BIN starting from 0x2169, length is 0x1ec78

    Code:
    0003FFF0 FF FF FF FF FF FF FF FF 07 C4 03 00 FF FF 8E FE ................
    
    total user and boot code length is 0x03c407, and use code's checksum is 0xfe8e. we also need to modify the last uint16, sum of those bytes in [0x2000, 0x3c407)

    summary, first we should modify model string at 0x2060, then regenerate a new BIN checksum and a new user code checksum

    of course, first we need to decrypt the firmware file from the official updater released by plextor, modify the model string, regenerate the checksum, then encrypt the modified firmware file, and finally use the official flasher to upload it to ssd.

    BUT BUT, actually the encryption algorithm used by plextor is a simple xor, but the key buffer generation is a boring process, i did not go deep in it.

    we can use another simple approach by using a debugger.
    put a breakpoint on official updater's decrypt routine, let it to decrypt the firmware first, after our breakpoint hits, dump the decrypted firmware from memory, we got the plaintext one, modify it, then flash by ourselves.

    then, how to flash the decrypted firmware to ssd?
    it is simple, just one ata command DOWNLOAD MICROCODE 92h.
    first divide the firmware into 2kb block, then send those blocks to ssd by using feature 3(download with offset), finally send a zero length 92h with feature 7 and LBA-mid=0x4c, LBA-hi=0x41.(0x414c means update both boot and user code)

    Code:
    128 times
    feature  sector lba-low  lba-mid      lba-hi          device     command
    3        4      0        offset0-7    offser8-15      0xa0       0x92
    
    finally
    7        0      0        0x4c         0x41            0xa0       0x92
    
    please check ata command set spec for more info about DOWNLOAD MICROCODE.

    and, one more thing
    looking at firmware's offset 0x2050, there is a string like DC7020G, this is the ext firmware info, first 6 bytes is the hardware revision? m5p has two different values(DC7020 and BC7020) and the official firmware updater has two firmware files, one for DC, one for BC, you should flash the one matching with your ssd.
    your ssd's current value is returned as additional production identifier in IDENTIFY DATA word170.
    and you can use a vsc to retrieve it
    Code:
    output a sector buffer(0x200) to device first
    uint8_t sectorBuffer[512]={0x0a, 0x07}
    
    task file
    feature sector lba-low lba-mid lba-hi  device command
    0xfc    1      0       0       0       0xa0   0xff
    
    then read a sector from device
    task file
    feature sector lba-low lba-mid lba-hi  device command
    0xfd    1      0       0       0       0xa0   0xff
    ext firmware info is the first 8 bytes of the output data
    
     
  20. Cindori, May 25, 2015
    Last edited: May 25, 2015

    Cindori macrumors 68040

    Cindori

    Joined:
    Jan 17, 2008
    Location:
    Sweden
    #20
    It's definitely possible to edit your SSD firmware to pose as an Apple SSD and get Trim that way. Ever since the Angelbird SSD was released I've gotten quite a bit of requests to try and use this method in Trim Enabler in order to avoid the Yosemite issues.

    Here's my take on why I never pursued this method:

    1. You have to reverse engineer every firmware manually. Just as tiamo outlines above - it is very technically challenging. I'm sure it took him quite some time to do this. And the end result is just one firmware. A completely new method may have to be devised for another manufacturer - and it may not be possible at all for some.

    2. Flashing can not be done from OS X. It may be if you connect through PCIe and write a completely new driver from scratch, but not from SATA (you can't send ATA commands through OS X driver).

    3. Flashing is a risky process. Screw something up and you brick the drive - and all it's contents.

    4. Modifying the firmware is likely to void your warranty and break support for manufacturers utilities such as firmware updaters.

    Even just one of these factors is enough for this method to not be a viable option for 99.9999% of users. And the last 0.0001% are likely to be technically knowledgeable enough to swiftly recover from the Yosemite bootscreen issue anyway.

    So in my opinion, it's not a viable solution to enable Trim. Still very interesting to see someone realise it.
     
  21. That-Guy macrumors 6502a

    That-Guy

    Joined:
    Feb 25, 2012
    Location:
    UK
    #21
    Some very good points, for me personally I would still flash it :D

    Especially now the 840 Evo Firmware has fixed the initial issues the drive had.

    I suppose it depends on the person :)
     
  22. crjackson2134 macrumors 68020

    crjackson2134

    Joined:
    Mar 6, 2013
    Location:
    Charlotte, NC
    #22
    The hoops we will jump through to avoid Apple's lock out techniques.

    I purchased a PCIe Adapter and an Apple/Samsung Blade SSD to tackle the problem. If I had an easy way to have the firmware of my 840 Pro modified I do that too.

    I'll probably end up moving the 840 Pro to my Linux laptop, and buying a couple of 1TB Anglrbird SSD's for my cMP (in addition to the blade SSD).

    The easiest and cheapest solution is still TrimEnabler which has worked perfectly for me (and still does when booting from the 840 Pro).
     
  23. Yaboze macrumors 6502a

    Yaboze

    Joined:
    May 31, 2007
    Location:
    The Garden State
    #23
    Hi Cindori!

    Can Disk Sensei manually trim drives with KEXT signing still on?
     
  24. h9826790 macrumors 604

    h9826790

    Joined:
    Apr 3, 2014
    Location:
    Hong Kong
    #24
    I would like to flash it as well. Of course I don't want to break it, but I don't mind to test it. However, it's too hard for me find out how to change the ident in the 840 Evo firmware :D
     
  25. simonsi macrumors 601

    simonsi

    Joined:
    Jan 3, 2014
    Location:
    Auckland
    #25
    Ah but if we limited progress to only what we had before, we wouldn't progress.

    I've been running 2 SSDs since Yosemite came out without Trim and no noticeable or measurable speed dropoff on either so far...
     

Share This Page