I administer a network of Mac clients and OSX server for a small business. I'm usually remote from the office so I look for ways of doing system admin tasks via ssh wherever possible. The main production OSX server, an ageing PowerMac G5 running headless, had crashed recently requiring a forced reboot (getting someone in the office to hold down the power button).
After any crash I usually run diskutil verify /.
In this case diskutil found corruption on the boot disk. To fix this on any Machine I have physical access to I would usually just start up in single user mode (hold down 'S' when booting), then run fsck -fy but in this case I couldn't get to the Machine, and there's no keyboard or monitor attached to it in any case.
For emergencies, I set the Macs up with an install DVD image in a partition. It would be possible to force the server to boot into the install partition, and then use Remote Desktop or ssh to access the box. I was looking for a simpler way.
Reading this Apple support article, I figured out that a cleaner way is to:
- Login to the remote Mac using ssh with an admin account.
- Enter sudo nvram boot-args="-x".
- Enter sudo shutdown -r now, you will be logged off and kicked out.
- Wait 5-10 minutes as the Mac will reboot in Safe Mode and carry out fsck until the file system is clean.
- Then login with ssh back into the Mac, run diskutil verify / to double check that the file system is clean.
- If all is okay set the boot mode back to normal by entering sudo nvram boot-args="" followed by sudo shutdown -r now.
[crarko adds: I haven't tested this one.]

