Command line target mode

You really do learn something new every day. Today, it was that EFI Macs can be set from the command line to boot into FireWire target mode on their next reboot (Open Firmware macs can do it, too, but it's more complicated). Nifty. Why would you want to do this? A couple of reasons. One, if you, like me, tend to be doing two, or three, or ten, things at once, holding down keys at startup can be a pain. I often hit 'reboot,' figure I have enough time to finish off a task on another machine, get caught up in the new task, and miss the window of opportunity to start the first machine in target disk mode, switch the startup disk, or whatever it was I wanted to reboot for. with the command line, it's "no muss, no fuss," just:
sudo nvram target-mode=1
That will set the machine to boot in target disk mode at it's next start-up. It only works for the next start-up, and can't be unset. That's a actually a bit of a pain: habitual command line users expect that '1' will toggle a behavior, and '0' will untoggle it, but that isn't the case here. Any value, even zero will work.
Another potential use is for a disk you suspect is corrupt, or to unstick a frozen system. Often, you can ssh in from another machine (assuming you have remote login turned on) even when finder crashes and a machine appears to be frozen. Just toggle target mode, issue a quick sudo shutdown -r now, and you can plug the offending machine into another computer and run your diagnostics. That, and it's a cool party trick.
Thanks to Matt for pointing this out.
Share
Categories
You really do learn something new every day. Today, it was that EFI Macs can be set from the command line to boot into FireWire target mode...
Add a Comment
Just a few hours ago a friend came over to back up his iMac G3 before it went to the shop. He had managed to break both USB ports. Fortunately sshd was enabled, so I was able to install and start a VNC server on the command line, then put a third machine in target mode and copy the data.
Next time will be much easier.
it can't be unset?
surely,
sudo nvram target-mode=""
should do the trick. it unsets other nvram variables.
This about redeems TUAW from the recent drought of properly useful tips!
As mentioned by other readers there is a GUI option for this, but I find it's faster to use the terminal in my dock for a lot of things. Except when you forget the command you need!
Also, the GUI method can't be accessed via SSH, although you would need to always have SSH enabled 'just in case'.
Or use the far easier GUI equivalent.
System Preferences -> Startup Disk
and choose "Target Disk Mode"
You can do the same in the startup volume preference. Just hit the big FireWire Button.
August 30 2006 at 6:39 PM Report abuse Permalink rate up rate down ReplyHot Apps on TUAW
Deals of the Day
more deals- Verizon Leather Sleeve for Tablets for $4 + free shipping
- Wicked Jaw Breaker Noise-Isolating In-Ear Headphones for $6 + free shipping
- Refurb Apple MacBook Air Laptops: 12" 64GB SSD for $699 + free shipping
- JVC Motion Sensing Clock Radio with Dual iPod Docks for $55 + free shipping
- Apple iPhone Headset with Mic for $4 + $2 s&h
- Refurb Apple iPod nano 8GB MP3 Player for $99 + free shipping, 16GB for $119
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



5 Comments