Sunteți pe pagina 1din 4

Optimizing Mac OS X for SSD drives Fredrik Poller http://poller.

se/2010/08/optimizing-mac-os-x-for-ssd-drives/

Home
Fredrik
Consulting
Code
Wordpress plugins
Nagios plugins
Simple as Pie
About
Performance
Subscribe

Fredrik Poller

Technical Mumbo Jumbo

Optimizing Mac OS X for SSD drives


by Fredrik Poller on August 27, 2010

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 isnt a problem. But it doesnt hurt to take some steps to minimize
the disk writes.

These tweaks are for Mac OS X 10.6 (Snow Leopard) 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.

1 of 4 10/2/10 8:36 AM
Optimizing Mac OS X for SSD drives Fredrik Poller http://poller.se/2010/08/optimizing-mac-os-x-for-ssd-drives/

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" "http://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)

For FileVault users as myself it seems to be a little bit trickier. The FileVault filesystem cant be remounted at startup, since
its 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 youre not using Spotlight you should consider disabling it by running this command.

$ sudo mdutil -a -i off

2 of 4 10/2/10 8:36 AM
Optimizing Mac OS X for SSD drives Fredrik Poller http://poller.se/2010/08/optimizing-mac-os-x-for-ssd-drives/

Ive been using the above settings (except #5) for about 6 months now without any issues.

Tagged as: atime, bash, filevault, hibernation, mac os x, motion sensor, sleep, spotlight, ssd

{ 3 comments read them below or add one }

Adam Hulin August 27, 2010 at 5:06 pm

Using sleep on a SSD actually lower its power consumption quite a bit, the Intel X25-M draws less than half during
sleep. It also doesnt need a lot of time to spin itself up again like a regular harddrive.

Still the difference in power consumption may not be worth to talk about when its just ~100mw ;)

Emil Vikstrm August 28, 2010 at 11:14 pm

noatime can be safely disabled on all writable drives, both SSD and HDD. Its almost always pointless to do a disk
write each time you open a file it slows down the computer without any benefit.

Andreas August 29, 2010 at 8:01 am

If you have optibay and ssd+hdd you can put the sleepimage on your hdd instead.

I use spotlight only for apps have disabled it for everything else. find & grep ftw.

Leave a Comment

Name *

E-mail *

Website

Submit

Previous post: Precaching with WP Super Cache

Next post: Amazon EC2 Micro instance, how fast is it?

Socialize

Categories

Benchmarks

3 of 4 10/2/10 8:36 AM
Optimizing Mac OS X for SSD drives Fredrik Poller http://poller.se/2010/08/optimizing-mac-os-x-for-ssd-drives/

Cloud computing
DNS
Encryption
Monitoring
Networking
Other software
Scripting
Storage
Web hosting

Tags

1password accelerator amazon ec2 apache apc aperture asterisk atime backblaze bash c cache coda disqus distributed filesystem djbdns dnscache fastcgi
filevault firewall freebsd geli glusterfs gmail google chrome google reader gruml handbrake hibernation joomla litespeed loopia mac os x mailplane motion sensor
mysql php plex plugin rackspace rewrite rsync simple as pie sleep sorting spotlight ssd ssh sysbench tinydns ubuntu
nagios nginx perl pf
vim viscosity wordpress xcache

Archives

September 2010
August 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010

Get smart with the Thesis WordPress Theme from DIYthemes.

WordPress Admin

4 of 4 10/2/10 8:36 AM

S-ar putea să vă placă și