📜 ⬆️ ⬇️

Optimize OSX for SSD

It makes no sense to write about replacing sidiruma on SSD, I think everything is already up to date on how to do it. Thank God, not a few articles have been written about this ( tyts , tyts ).
image
But how far to set up the system to work with HDD and SSD is known not by everyone.

Since, for an SSD, rewriting cycles are critical, and it is better not to fill it with more than 80% of its capacity, there is no point in throwing personal information on it. By this we transfer everything to HDD. Flies separately, cutlets separately ©.

We transfer the user's folder to the HDD (method 1)


In order to transfer the user's folder, go to the settings, and change the path to its folder:
System Preferences> Users & Groups> (right click on user)> Advanced Options
image
Because I learned about this method too late (thanks to vermilion1 ), here's a hard way to transfer your home folder =)

We transfer / Users to HDD (method 2)


Format the hdd and copy all the contents of the / Users directory to it.
')
To mount a new section in / Users, you need to make an entry in / etc / fstab .
For this you need to know the UUID of your hard drive. Go to the console, and execute:
diskutil info /Volumes/HDD/ | grep UUID 


You can edit / etc / fstab on OSX as follows:
 sudo vifs 


Add a line with your UUID to the end of the opened file:
UUID=_UUID /Users hfs rw 1 0
image

Now our task is to demolish everything with / Users, otherwise if the directory is not empty, the screw cannot be mounted.
To do this, boot from Recovery HD :
image

We open the terminal, and delete everything from the / Users folder:
 sudo rm -rf /Users/* 

image

Now we are overloaded into a normal system, and we check whether everything was mounted correctly:
 df -h 

image
If everything is bad, most likely you will understand it without this command :)

We transfer the hibernation file to HDD


Create a folder where we will store the file hibernation:
 mkdir /Users/image 


Turning off hibernation:
 sudo pmset -a hibernatemode 0 


We transfer the hibernation file to this folder:
 sudo pmset –a hibernatefile /Users/image/sleepimage 


Turn on hibernation:
 sudo pmset -a hibernatemode 3 


Check if the file appeared in the folder, if so, you can delete the old one:
 sudo rm –f /private/var/vm/sleepimage 


Disable the function of fixing the last file access


To disable this feature, create the file /Library/LaunchDaemons/com.hdd.noatime.plist
And write the following in it:

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.hdd.noatime</string> <key>ProgramArguments</key> <array> <string>mount</string> <string>-vuwo</string> <string>noatime</string> <string>/</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> 


We give rights to the file:
 sudo chown root:wheel /Library/LaunchDaemons/com.hdd.noatime.plist 


After rebooting, you can check that everything worked:
 mount | grep noatime 


Enable TRIM


By default, TRIM support only works for Apple-supplied drives.
As it turned out, TRIM is not for everyone. Read more here . (thanks to SeiFeR )
image
In order to enable TRIM support for third-party SSD disks in 10.7, you need to do the following:

Backup the kernel module:
 sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original 


The following command replaces the line APPLE SSD with zeros in the IOAHCIFamily.kext module:
 sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00).{9}(\x00\x51)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage 


After that you need to clean the modules cache:
 sudo kextcache -system-prelinked-kernel $ sudo kextcache -system-caches 


Reboot the computer and enjoy :)

ps I will be glad to any additions / corrections. Thank.

Source: https://habr.com/ru/post/144305/


All Articles