Difference between revisions of "Target Disk Mode"

From FreekiWiki
Jump to navigation Jump to search
(Created page with "''Work in Progress'' Target disk mode is a fancy firmware feature provided by Apple since 1999. It essentially allows you to boot a Mac as if it were an external hard drive, and…")
 
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
''Work in Progress''
 
''Work in Progress''
  
Target disk mode is a fancy firmware feature provided by Apple since 1999. It essentially allows you to boot a Mac as if it were an external hard drive, and read the hard drive on another machine via firewire. Turns out, the host computer (the one reading the target drive) doesn't have to be running OSX, it just has to be able to read the file system on the drive. For our purposes, we won't be reading data, just over-writing the drives with a new operating system. Linux can read HFS+ just fine, no problem, anyhow. So there.  
+
Target disk mode is a fancy firmware feature provided by Apple since 1999. It essentially allows you to boot a Mac as if it were an external hard drive, and read the hard drive on another machine via firewire. Turns out, the host computer (the one reading the target drive) doesn't have to be running OSX, it just has to be able to read the file system on the drive. For our purposes, we won't be reading data, just over-writing the drives with a new operating system. Linux can read HFS+ just fine*, no problem, anyhow. So there.  
  
===Installing Ubuntu onto an Intel Mac via TDM===
+
<nowiki>*</nowiki>A caveat is that Linux will not be able to create, write to, or mount HFS+ filesystems without the <code>hfsprogs</code>, <code>hfsutils</code> and <code>hfsplus</code> packages (in Debian-based distros).  Depending on whether you're booting a live environment, a console-based installer, or a standard installed environment, these packages may not be available.  Most every PPC release of Linux has these packages included from the outset.  Alternate-installer x86 images frequently do not.<br>[[User:Scellef|Scellef]] 02:00, 15 August 2012 (UTC)
*Turn the subject Mac off
+
 
 +
==Testing Done Thus Far==
 +
*Hardware detection kit does not show the drive on the 1394 PCI bus slot, not useful for detecting hardware on the target machine, just the host.
 +
*Disk wiping via Floe works well. Too well.
 +
*Live Ubuntu or Debian boot detects the target drive.
 +
**Should try this with a Mac with data on it to see how the live boot deals with the file system, should be fine.
 +
*I installed the pre-seeded network image to an Intel Core 2 Duo iMac, and it will not boot.
 +
**Will see if installing via CD works any better (Intel Macs should be able to do this just fine, PPCs will be tricky because the host machine has to be able to boot from this disk too, I imagine there won't really be instances where this is an issue).
 +
*I installed the pre-seeded network image to a 27" Aluminum iMac and a Core 2 Duo Mac Mini, and it booted gloriously.
 +
*Drives could be recognized, and successfully written to through a PCMCIA 1394 expansion card .
 +
 
 +
==Installing Ubuntu onto an Intel Mac via TDM==
 +
*Turn the target Mac off
 
*Connect the target Mac via firewire to a Linux box or another Mac
 
*Connect the target Mac via firewire to a Linux box or another Mac
 
*Figure out what kind of bootable media you want to use for the host computer (insert a disk into optical drive, make sure the external drive you want to boot from works, check your boot order, etc)
 
*Figure out what kind of bootable media you want to use for the host computer (insert a disk into optical drive, make sure the external drive you want to boot from works, check your boot order, etc)
NEED TO TEST NETBOOT
 
 
*Turn the target Mac on while holding down the '''T''' key
 
*Turn the target Mac on while holding down the '''T''' key
*The subject screen should switch to a blue screen saver with a yellow firewire symbol
+
*The target screen should switch to a blue screen saver with a yellow firewire symbol
 
*You should be able to read the target drive from the host computer Disk Utility app
 
*You should be able to read the target drive from the host computer Disk Utility app
 
*Reboot the host computer and select the boot option you want to use
 
*Reboot the host computer and select the boot option you want to use
 
*Be sure to select the correct hard drive during the installation or you will loose everything on the host computer
 
*Be sure to select the correct hard drive during the installation or you will loose everything on the host computer
 +
 +
===EFI Based Systems===
 +
* Newer revisions of Mac firmware added traditional BIOS MBR support.  Newer Mac systems tend to have this updated firmware and, accordingly, can image and then boot from drives using our standard installers without issue.
 +
** ''TODO'':  Need to investigate flashing and updating Mac firmware.
 +
** ''TODO'':  Need to determine range of Intel Macs capable of supporting BIOS MBRs from later firmware revisions.
 +
* If using firmware that doesn't outright support MBRs, then a hybrid GPT/MBR solution must be implemented.  I installed Ubuntu using the live image from the network by following the steps in the following section
 +
====Hybrid GPT/MBR -- Trial 1====
 +
*Having booted to the desktop of the live image, download a bootable image of rEFIt:
 +
    $> wget http://prdownloads.sourceforge.net/refit/rEFIt-0.14.cdr.gz
 +
*Unzip the image:
 +
    $> gunzip rEFIt-0.14.cdr.gz
 +
*Start '''Gparted''' and select '''Device -> Create Partition Table'''.  Click '''Advanced''' and ensure the partition table type is ''msdos''.
 +
*Create a new partion with approximately ''200 MB'' of space allocated, then '''Edit -> Apply All Operations'''
 +
*Open a terminal and run the following (making sure that /dev/sda is the disk inside your Mac):
 +
    $> sudo dd if=rEFIt-0.14.cdr of=/dev/sda1
 +
*Proceed with the standard installer (Icon on the desktop).  When you arrive at the partitioning screen, choose the option ''Use largest contiguous block of free space'', and walk through the rest of the installation.  Ensure that GRUB is installed to the block device and not a partition.
 +
* Reboot the Mac (the PC can do whatever; rebooting the Mac is analogous to removing a USB drive).  Probably, you'll have to wait around for a while, but it should eventually boot.  Mac OS can purportedly "bless" other operating systems to load (relatively) seamlessly with its firmware.  See [[Target Disk Mode#Resources|Resources]] for more information.
 +
* If Ubuntu doesn't load, reboot and hold down ''Option'' to bring up Boot Camp's bootable devices list.  You should see an option for "Windows".
 +
* By all accounts, this should not have worked, as rEFIt needs to be installed in such a way as to communicate with Boot Camp (Mac's builtin bootloader).  Additionally, the hybrid GPT/MBR model that early Intel Mac firmware made use of relied on essentially a hack to synchronize GPT and MBR maps across different partitions (volumes in Mac-a-nese), and communicate them through BIOS emulation.  rEFIt explicitly ensure the two tables are synchronized by virtue of <code>gptsync</code>, or something similar.  Unfortunately, this is the biggest success to date. [[User:Scellef|Scellef]] 03:03, 15 August 2012 (UTC)
 +
* After playing around further with our dear friend, the iMac (7,1), further, it stopped booting reliably from disk.  The particular model this was conducted from has a faulty optical drive and/or ATA controller, thereby preventing booting from optical media as well.  Generally, an Eternal White Screen would present itself (presumably Boot Camp throwing fits).  Bringing up Boot Camp's disk selection menu shows a "Windows" disk, but hangs on the Eternal White Screen.  Booting to network still works, eventually.
 +
 +
====Hybrid GPT/MBR -- Trial 2====
 +
Success (I think)!  Working on the same iMac from the steps above, I managed to successfully install rEFIt and have it reliably boot to Ubuntu (albeit after a grueling wait).
 +
* After installing Ubuntu from the network following the steps outlined in Trial 1, boot from the network to the OSX live environment.
 +
* Open up Disk Utility and select the HDD with the ubuntu install.  You should see three partitions if you followed the steps above (/dev/disk0s1 -- The rEFIt partition, /dev/disk0s2 -- Ubuntu / partition, /dev/disk0s5 -- Extended partition, /dev/disk0s6 -- Logical swap partition).  Select the first partition, and format it to MSDOS.
 +
* Download the Mac installer for rEFIt (browse to: http://prdownloads.sourceforge.net/refit/rEFIt-0.14.dmg?download), double click to mount the image, ''Command+A'' to select everything, ''Command+C'' to copy it.
 +
* We now need to make a mount point for the boot partition in which we'll be installing rEFIt.  Open a terminal and enter the following:
 +
    $> sudo mkdir /efi
 +
    $> sudo mount -t msdos /dev/disk0s1 /efi
 +
    $> open /efi
 +
* The last line from the previous step will open Finder in the /efi directory.  ''Command+V'' to paste the contents of the rEFIt image into the directory and then, in the terminal, enter the following:
 +
    $> sudo bless --mount /efi --setBoot --file /efi/efi/refit/refit.efi --labelfile /efi/efi/refit/refit.vollabel
 +
* Finally, reboot the system and you should land in Ubuntu.  Reboot the system again, and Ubuntu will greet you once more.
 +
* '''Next Steps for Trial 3''':  Reinstall the system from the network (with a non-preconfigured image), and attempt to follow the process from start to finish.  Things to make note of:
 +
** How much space rEFIt takes up in the /efi partition
 +
** Success ratio of booting into Ubuntu pre-rEFIt
 +
** Success ratio of booting into Ubuntu post-rEFIt
 +
* '''Next Steps for Trial 4''': Reinstall the system from the network (with a non-preconfigured image), format the entire disk (sans swap space) with an HFS+ root partition (will need to be in a Live environment in order to install the HFS packages until a preseeded image is generated), and attempt to install rEFIt under /boot.
 +
 +
==Wiping systems==
 +
 +
===Resources===
 +
* History and overview of Mac's Targeted Disk Mode
 +
**http://www.1394ta.org/press/WhitePapers/TargetDiskMode.html
 +
* General overview of Mac EFI vs. UEFI and installing Ubuntu to Intel Mac
 +
**http://www.rodsbooks.com/ubuntu-efi/index.html
 +
* Ubuntu documentation on differences between built-in UEFI support and Mac EFI compromises
 +
**https://help.ubuntu.com/community/UEFIBooting
 +
* General overview of Mac's bootstrapping process, requirements, Mac EFI, and ''Volume Blessing''
 +
**http://help.bombich.com/kb/troubleshooting/what-makes-a-volume-bootable
 +
 +
[[Category:Macintosh Archive]]

Latest revision as of 12:22, 21 February 2014

Work in Progress

Target disk mode is a fancy firmware feature provided by Apple since 1999. It essentially allows you to boot a Mac as if it were an external hard drive, and read the hard drive on another machine via firewire. Turns out, the host computer (the one reading the target drive) doesn't have to be running OSX, it just has to be able to read the file system on the drive. For our purposes, we won't be reading data, just over-writing the drives with a new operating system. Linux can read HFS+ just fine*, no problem, anyhow. So there.

*A caveat is that Linux will not be able to create, write to, or mount HFS+ filesystems without the hfsprogs, hfsutils and hfsplus packages (in Debian-based distros). Depending on whether you're booting a live environment, a console-based installer, or a standard installed environment, these packages may not be available. Most every PPC release of Linux has these packages included from the outset. Alternate-installer x86 images frequently do not.
Scellef 02:00, 15 August 2012 (UTC)

Testing Done Thus Far

  • Hardware detection kit does not show the drive on the 1394 PCI bus slot, not useful for detecting hardware on the target machine, just the host.
  • Disk wiping via Floe works well. Too well.
  • Live Ubuntu or Debian boot detects the target drive.
    • Should try this with a Mac with data on it to see how the live boot deals with the file system, should be fine.
  • I installed the pre-seeded network image to an Intel Core 2 Duo iMac, and it will not boot.
    • Will see if installing via CD works any better (Intel Macs should be able to do this just fine, PPCs will be tricky because the host machine has to be able to boot from this disk too, I imagine there won't really be instances where this is an issue).
  • I installed the pre-seeded network image to a 27" Aluminum iMac and a Core 2 Duo Mac Mini, and it booted gloriously.
  • Drives could be recognized, and successfully written to through a PCMCIA 1394 expansion card .

Installing Ubuntu onto an Intel Mac via TDM

  • Turn the target Mac off
  • Connect the target Mac via firewire to a Linux box or another Mac
  • Figure out what kind of bootable media you want to use for the host computer (insert a disk into optical drive, make sure the external drive you want to boot from works, check your boot order, etc)
  • Turn the target Mac on while holding down the T key
  • The target screen should switch to a blue screen saver with a yellow firewire symbol
  • You should be able to read the target drive from the host computer Disk Utility app
  • Reboot the host computer and select the boot option you want to use
  • Be sure to select the correct hard drive during the installation or you will loose everything on the host computer

EFI Based Systems

  • Newer revisions of Mac firmware added traditional BIOS MBR support. Newer Mac systems tend to have this updated firmware and, accordingly, can image and then boot from drives using our standard installers without issue.
    • TODO: Need to investigate flashing and updating Mac firmware.
    • TODO: Need to determine range of Intel Macs capable of supporting BIOS MBRs from later firmware revisions.
  • If using firmware that doesn't outright support MBRs, then a hybrid GPT/MBR solution must be implemented. I installed Ubuntu using the live image from the network by following the steps in the following section

Hybrid GPT/MBR -- Trial 1

  • Having booted to the desktop of the live image, download a bootable image of rEFIt:
   $> wget http://prdownloads.sourceforge.net/refit/rEFIt-0.14.cdr.gz
  • Unzip the image:
   $> gunzip rEFIt-0.14.cdr.gz
  • Start Gparted and select Device -> Create Partition Table. Click Advanced and ensure the partition table type is msdos.
  • Create a new partion with approximately 200 MB of space allocated, then Edit -> Apply All Operations
  • Open a terminal and run the following (making sure that /dev/sda is the disk inside your Mac):
   $> sudo dd if=rEFIt-0.14.cdr of=/dev/sda1
  • Proceed with the standard installer (Icon on the desktop). When you arrive at the partitioning screen, choose the option Use largest contiguous block of free space, and walk through the rest of the installation. Ensure that GRUB is installed to the block device and not a partition.
  • Reboot the Mac (the PC can do whatever; rebooting the Mac is analogous to removing a USB drive). Probably, you'll have to wait around for a while, but it should eventually boot. Mac OS can purportedly "bless" other operating systems to load (relatively) seamlessly with its firmware. See Resources for more information.
  • If Ubuntu doesn't load, reboot and hold down Option to bring up Boot Camp's bootable devices list. You should see an option for "Windows".
  • By all accounts, this should not have worked, as rEFIt needs to be installed in such a way as to communicate with Boot Camp (Mac's builtin bootloader). Additionally, the hybrid GPT/MBR model that early Intel Mac firmware made use of relied on essentially a hack to synchronize GPT and MBR maps across different partitions (volumes in Mac-a-nese), and communicate them through BIOS emulation. rEFIt explicitly ensure the two tables are synchronized by virtue of gptsync, or something similar. Unfortunately, this is the biggest success to date. Scellef 03:03, 15 August 2012 (UTC)
  • After playing around further with our dear friend, the iMac (7,1), further, it stopped booting reliably from disk. The particular model this was conducted from has a faulty optical drive and/or ATA controller, thereby preventing booting from optical media as well. Generally, an Eternal White Screen would present itself (presumably Boot Camp throwing fits). Bringing up Boot Camp's disk selection menu shows a "Windows" disk, but hangs on the Eternal White Screen. Booting to network still works, eventually.

Hybrid GPT/MBR -- Trial 2

Success (I think)! Working on the same iMac from the steps above, I managed to successfully install rEFIt and have it reliably boot to Ubuntu (albeit after a grueling wait).

  • After installing Ubuntu from the network following the steps outlined in Trial 1, boot from the network to the OSX live environment.
  • Open up Disk Utility and select the HDD with the ubuntu install. You should see three partitions if you followed the steps above (/dev/disk0s1 -- The rEFIt partition, /dev/disk0s2 -- Ubuntu / partition, /dev/disk0s5 -- Extended partition, /dev/disk0s6 -- Logical swap partition). Select the first partition, and format it to MSDOS.
  • Download the Mac installer for rEFIt (browse to: http://prdownloads.sourceforge.net/refit/rEFIt-0.14.dmg?download), double click to mount the image, Command+A to select everything, Command+C to copy it.
  • We now need to make a mount point for the boot partition in which we'll be installing rEFIt. Open a terminal and enter the following:
   $> sudo mkdir /efi
   $> sudo mount -t msdos /dev/disk0s1 /efi
   $> open /efi
  • The last line from the previous step will open Finder in the /efi directory. Command+V to paste the contents of the rEFIt image into the directory and then, in the terminal, enter the following:
   $> sudo bless --mount /efi --setBoot --file /efi/efi/refit/refit.efi --labelfile /efi/efi/refit/refit.vollabel
  • Finally, reboot the system and you should land in Ubuntu. Reboot the system again, and Ubuntu will greet you once more.
  • Next Steps for Trial 3: Reinstall the system from the network (with a non-preconfigured image), and attempt to follow the process from start to finish. Things to make note of:
    • How much space rEFIt takes up in the /efi partition
    • Success ratio of booting into Ubuntu pre-rEFIt
    • Success ratio of booting into Ubuntu post-rEFIt
  • Next Steps for Trial 4: Reinstall the system from the network (with a non-preconfigured image), format the entire disk (sans swap space) with an HFS+ root partition (will need to be in a Live environment in order to install the HFS packages until a preseeded image is generated), and attempt to install rEFIt under /boot.

Wiping systems

Resources