On Linux, I use the noatime,nodiratime,nobarrier,data=writeback mount optioins in /etc/fstab to trade filesystem safety/consistency/integrity for speed which makes sense for local development. Is there a way to do something similar or to otherwise make such a trade off for the other OS X developers on my team?
- 129
-
2What hardware do the developers use? What storage media? What's the link speed? (You can open System Information and start with Storage and work your way up the chain). Also - what is the current bottleneck in the developer's workflow? – bmike Feb 06 '15 at 19:56
-
@bmike The method I use in the description can be used to make the trade off I describe in the descrption on pretty much any filesystem on pretty much any medium under Linux. What does link speed have to do with filesystems as in the title of my question? Also as per the descrpiton, this is a trade off I want to know how to do and not a bottleneck. – Ross Patterson Feb 06 '15 at 23:54
-
Give the developers solid state disks - makes more difference than altering parameters and for a developer can be justified in cost by the time saved – mmmmmm Sep 09 '17 at 19:00
-
@Mark Under Linux with a modern, fast SSD, the options above still greatly decrease test runtime for my projects whose test have to run against a real DB making my day-to-day development much faster. – Ross Patterson Sep 10 '17 at 00:31
1 Answers
Going with the default filesystem on a OS X/macOS install
The man page for mount on macOS lists only two options that are performance related to hfsplus:
- async All I/O to the file system should be done asynchronously. This can be somewhat dangerous with respect to losing data when faced with system crashes and power outages. This is also the default. It can be avoided with the noasync option.
- noatime Do not update the file access time when reading from a file. This option is useful on file systems where there are large numbers of files and performance is more criti- cal than updating the file access time (which is rarely ever important).
So, only the noatime option is left to further improve on the default behaviour.
Since there is no fstab on macOS you have to (re-)mount your filesystems in another way.
The most popular search engine hit to achieve an automatic re-mount lists this method:
Create a file called com.noatime.plist in /Library/LaunchDaemons. If you only have 1 SSD partition – that is where your OS is booting from – this is all you need.
<?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>/sbin/mount</string>
<string>-vuwo</string>
<string>noatime</string>
<string>/</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
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 or
sudo launchctl load -w /Library/LaunchDaemons/com.noatime.root.plist
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 put: it executes this command at boot time (well, after boot, during the load sequence for the rest)
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 required since it’s a headless command above; although presumably it might show up in the system log somewhere and in cases 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)
Going with alternate filesystem options altogether
Apple filesystems are quite bad from the start and support for alternative filesystems is also lacking. But that does not mean you are completely out of options.
- You might go for RAM-Disks
- You could try to use alternative filesystems like ZFS or another filesystem to your liking via fuse.
- You might try and use the as of Sierra, hm, 'usable' new filesystem AFPS (strongest caveats: is beta still and will behave like one for months to come)
- You might be a conservative blockhead and sacrifice overhead things like journaling or corestorage volumes with encryptions (that would be otherwise not recommended, but considering your special needs…). Alas, these are not mount options but need you to provide partitions in that style. (And while the mount option noatime might be applied there also, I do not have benchmarks ready to compare on a modern Sierra system running unjournaled filesystems vs the defaults.)