Force my MacBook Air that uses external USB as boot drive to hibernate/suspend to disk?
There are several questions about hibernating (suspending to disk) but most are concerned with battery life and so many answers basically say just use sleep (suspend to RAM) because the battery will last better than you think. Other answers are simply out of date.
I don't want to use hibernate because of battery concerns. I want it because the SSD is dead and I use an external USB 3 hard drive as my boot drive. In other words, I have only this one drive. No working built-in drive.
It's almost as fast and I'm happy with it. But if the cable moves too much while the MacBook is in my backpack the OS will crash and anything that was in RAM is lost. I want to transport the gear with the drive separate from the computer. This requires true hibernate and not just sleep.
I've read that MacOS has several heuristics about when to suspend to disk (hibernate) rather than to RAM (sleep) and that one of those is whether any USB devices are plugged in, which for me is always.
I have sudo pmset -a hibernatemode 25
but when I put the Mac to sleep now it starts right up when pressing a key or plugging in the AC, which tells me it's not suspending.
Is there a way to really suspend my MacBook to disk, then safely remove the HD, transport everything, plug the drive back in, wake up the Mac, all without losing what I was working on at the time?
Mid-2013 11" Air / Sierra 10.12.6
Output of sudo pmset -g assertions
2017-08-20 12:10:43 +1000
Assertion status system-wide:
BackgroundTask 0
ApplePushServiceTask 0
UserIsActive 1
PreventUserIdleDisplaySleep 0
PreventSystemSleep 0
ExternalMedia 1
PreventUserIdleSystemSleep 1
NetworkClientActive 0
Listed by owning process:
pid 59(powerd): [0x0000004100088000] 39:29:46 ExternalMedia named: "com.apple.powermanagement.externalmediamounted"
pid 251(mds_stores): [0x0001272e000ba305] 00:04:18 BackgroundTask named: "com.apple.metadata.mds_stores.power"
pid 114(hidd): [0x000100dd0009997a] 03:36:53 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4294967962.3"
Timeout will fire in 110 secs Action=TimeoutActionRelease
pid 72(mds): [0x000126ae000ba2d1] 00:06:26 BackgroundTask named: "com.apple.metadata.mds.power"
pid 57(configd): [0x000122640007a186] 00:24:44 DenySystemSleep named: "InternetSharingPreferencePlugin"
pid 193(coreaudiod): [0x000122260001889a] 00:25:46 PreventUserIdleSystemSleep named: "com.apple.audio.AppleHDAEngineOutput:1B,0,1,1:0.context.preventuseridlesleep"
Created for PID: 438.
Kernel Assertions: 0x4=USB
id=503 level=255 0x4=USB mod=1/1/70, 10:00 am description=com.apple.usb.externaldevice.14500000 owner=BUP Slim Mac SL
Idle sleep preventers: IODisplayWrangler
Solution 1:
pmset with hibernatemode=25 might work.
sudo pmset -a hibernatemode 25 #to change to "safe sleep", aka, hibernate
pmset sleepnow #to make it sleep now
And, to put it back to "normal" laptop mode, use sudo pmset -a hibernatemode 3.