Clear DNS cache on OS X 10.8 Mountain Lion

Historically, the Directory Services were responsible for DNS queries and caching on Mac OS X 10.5 and earlier. Back then, to clear the DNS cache one would issue the “dscacheutil -flushcache” command. With the further development of various services based on the multicast DNS a mDNS service fully took over both unicast and multicast DNS queries and response caching on later OS X versions.

While the “dscacheutil” is still there even on OS X 10.8 Mountain Lion, it won’t reset the caches properly. The correct method to clear DNS cache on 10.7 and 10.8 is to restart the mDNS service, “mDNSResponder”:

sudo killall -HUP mDNSResponder

If this doesn’t seem to help, try reloading the service:

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

Make a local snapshot using MobileBackups on Mac OS X Lion

Mac OS X Lion introduced MobileBackups, a new TimeMachine feature that stores local backups of your files while you are away from your main TimeMachine backup disk. This feature stores filesystem snapshots inside a virtual drive on your local disk, so should not be considered as a main backup strategy. The system automatically does periodic snapshots, but you can also manually initiate the process.

To make a local snapshot of the current state of your files, enter this command in your Terminal window:

sudo tmutil snapshot

It should complete almost instantaneously, giving you a tick in the TimeMachine backups timeline.

 

Monitoring disk I/O on MacOS X with iosnoop, fs_usage and iotop

MacOS X comes with great command line programs for debugging and troubleshooting various issues with your system. If you ever need to check what program is accessing your disk, use these three programs: iosnoop, fs_usage and iotop.

All require the sudo password, as they tap deep into your kernel to get the information.

Continue reading