*적용중인 도장
저는 개인적으로 그냥 TRIM 정도만 ENABLE 된 상태에서 사용하는 것도 무방하다고 생각 하오나 최적화라는 의미에서 본다면 재미있는 글이라서 올려 봅니다.
---
SSD drives are very good speed wise. If you have the money, upgrading
from a regular hard drives makes a world of difference. There are
however some drawbacks compared to spinning hard drives, mainly the
limit on how many writes you can do before things get ugly. For most
users, this isn’t a problem. But it doesn’t hurt to take some steps to
minimize the disk writes.
These tweaks are for Mac OS X 10.6 (Snow Leopard) and 10.7 (Lion) and mainly for laptop users.
1. Sleeping mode
By default, when closing the lid on a MacBook, the content of the ram is
saved to disk for safety. The ram is still powered on however, and is
used when starting up again. The content saved on disk is only used in
case of a power loss. This behavior can be changed, at the cost of some
safety, so that memory content is not saved to disk. On the bright side,
you also save some disk space (equal to the amount of your RAM).
We can start by checking the current setting, fire up Terminal.app and type the following.
$ sudo pmset -g | grep hibernatemode
hibernatemode 3
3 is the default mode, we want to change this to 0 to disable disk writes.
$ sudo pmset -a hibernatemode 0
Now we can remove the old sleepimage.
$ sudo rm /var/vm/sleepimage
macworld.com has more information on this.
2. Hard drive sleep
Putting SSD hard drives to sleep has no benefit, and some SSD drives has
a history of freezing up when put to sleep. This can be disabled under
System Preferences -> Energy Saver. Remember to disable it for both
Battery and Power Adapter mode.
3. Sudden motion sensor
Having the Sudden motion sensor enabled for a SSD drive makes no sense, this can be disabled with the following command.
$ sudo pmset -a sms 0
4. Enable noatime for SSD filesystems
Every time a file is accessed its access time is modified to reflect it.
This can be disabled to save additional writes. To do this for the
local filesystem create the file
/Library/LaunchDaemons/com.noatime.root.plist with the following
content.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.noatime.root</string>
<key>ProgramArguments</key>
<array>
<string>mount</string>
<string>-uwo</string>
<string>noatime</string>
<string>/</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
This will execute mount -uwo noatime / upon system startup, remounting
the root filesystem with the noatime option. This can be verified after a
reboot with the following command.
$ mount |grep noatime
/dev/disk0s2 on / (hfs, local, journaled, noatime)
Note on FileVault: The instructions below are for legacy FileVault only.
FileVault 2 users (Lion) doesn’t have to do anything special except the
instructions above. Please see Apple article HT4790 on how to upgrade from legacy FileVault to FileVault 2.
For FileVault users as myself it seems to be a little bit trickier. The
FileVault filesystem can’t be remounted at startup, since it’s not
mounted until the user logs in. We can however create a script and a
login hook to be run at login.
Lets start by creating a script called /usr/local/bin/remount_noatime with the following content.
#!/bin/bash
/sbin/mount -uwo noatime /Users/$1
$1 will contain the username when the script is run. Make it executable and create the login hook.
$ sudo chmod +x /usr/local/bin/remount_noatime
$ sudo defaults write com.apple.loginwindow LoginHook /usr/local/bin/remount_noatime
The script is now run with root privileges when a user logs in.
5. Disable Spotlight
If you’re not using Spotlight you should consider disabling it by running this command.
$ sudo mdutil -a -i off
I’ve been using the above settings (except #5) for about 6 months now without any issues.