Thursday, June 09, 2011

How to run diskutil in single user mode on OSX Leopard and Snowleopard

After spending some wonderful time troubleshooting a Macbook Pro with a failing drive, I wanted to know if the filesystem was corrupted or if it was indeed a disk failure. In order to know this, I had to read the SMART data off the drive. Here is my attempt

First you need to boot into single user mode by turning on the computer and immediately pressing CMD + S where the CMD key is the Apple key. Continue to hold down command + s until you see the verbose logging appear.

Then mount your drive in r/w mode with:

mount -uw /

Then we need to load a couple of required system modules. DirectoryServices is only required if you want networking support.

launchctl load /System/Library/LaunchDaemons/
launchctl load /System/Library/LaunchDaemons/
launchctl load /System/Library/LaunchDaemons/
launchctl start
launchctl load /System/Library/LaunchDaemon/
launchctl load /System/Library/LaunchDaemons/

Now you should be able to at least run diskutil. You can run the following to check your specific drive
diskutil /dev/disk0sd2

You can enumerate your drives with

ls /dev/disk *

Right now its hanging for me but at least its running in single user mode which is better than before.


Anonymous said...

Did you ever get diskutil working in single mode? I tried everything

mklement0 said...

This shows how to get it to work (article is in German, but the required commands are shown; method still works as of OS X 10.9.2)

Anonymous said...

I keep getting "Permission Denied" when entering the first command