OS X - Setting No-Access-Time on OS X SSD Volumes
Update 2016-08-06: I’ve verified the instructions for a single SSD do still work under 10.11 El Capitan. I don’t have a dual drive Mac anymore to test with, but in limited testing with a VM the 2nd drive didn’t remount with noatime. Be warned.
Background
Having a filesystem update the last accessed time of every file is not something most people need. It puts needless wear on an SSD turning even read operations into writes.
Disabling last access time (or “noatime”) is a simple procedure if there’s only one volume that needs the operation. But what if there are multiple SSDs, or multiple partitions on an SSD. In this post we’ll walk through how to disable noatime for all partitions on a system.
The “noatime” plist file for the OS drive
Here’s an example file file called com.noatime.plist
which goes into /Library/LaunchDaemons
. If you only have 1 SSD partition that is where your OS is booting from, this is all you need.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?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</string>
<key>ProgramArguments</key>
<array>
<string>mount</string>
<string>-vuwo</string>
<string>noatime</string>
<string>/</string>
</array>
<key>RunAtLoad</key><true/>
</dict>
</plist>
Place that file in the directory /Library/LaunchDaemons
Set the ownership of the file with the command
sudo chown root:wheel /Library/LaunchDaemons/com.noatime.plist
sudo chmod 644 /Library/LaunchDaemons/com.noatime.plist
Restart the system
To verify, enter the command “mount” at a Terminal prompt. You should see “noatime” listed as an attribute of your filesystem.
But what does it do? Well, simply it executes this command at boot time (well, after boot, during the load sequence)
mount -vuwo noatime /
I’m assuming you have a clue what the “mount” command does, but look at the options:
-v (verbose, actually.. this is not absolutely require since it’s a headless command, although presumably it might show up in the system log somewhere and in case of failure
-u (The -u flag indicates that the status of an already mounted file system should be changed. By this point in the load sequence our filesystems have already been mounted)
-w (Mount the file system read-write - probably not 100% needed)
-o noatime (Set the noatime option)
What if you have more than one SSD or partition?
Note I tried this on a VM running El Capitan and the 2nd SSD didn’t remount with noatime. I think it may be a race condition with when the second drive is initially mounted, so be warned. The manual command to remount still works just not the launchctl job.
You already have a noatime plist file and want to make another one, perhaps because you:
- have multiple SSDs
- have an SSD that isn’t your root partition
- have multiple partitions on your SSD
Let’s start by assuming you have a drive called Flash that is your 2nd SSD. It would typically mount as /Volumes/Flash. If we were going to execute a command to remount it with the noatime option we’d execute:
mount -vuwo noatime /Volumes/Flash
Try executing that command (with “sudo” in front) and verify that it remounts your filesystem correctly.
If that worked, let’s create a new plist file to do just that. Name it something like com.noatime-flash.plist
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?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-flash</string>
<key>ProgramArguments</key>
<array>
<string>mount</string>
<string>-vuwo</string>
<string>noatime</string>
<string>/Volumes/Flash</string>
</array>
<key>RunAtLoad</key><true/>
</dict>
</plist>
Important things:
- (line 6) change the com.my.noatime string to something unique across your various plist files or it won’t execute
- (line 12) change the / to match your filesystem location (typically /Volumes/YOUR_DRIVE_NAME)
See the earlier section for info on how to install your plist file and verify that it’s working, except now you may have two (or more!)
Leave a Comment