Apple TV
From CafeWiki
Contents |
Apple TV
Having tried a number of different solutions for serving media files, including D-Link media servers, MS Windows Media Center, Yamaha RXV-2700 via ethernet and probably a couple of others, it is now time to try out the Apple TV. Since moving more to an Apple frame of mind in the past couple of years (both Sean and I have MacBook Pro laptops, as well the iPhones and iPods are sprouting in both families) the Apple TV seems to be a logical next step for serving media. It also holds some promise for the holy grail of cable TV, to ditch the subscription to dozens of channels with no desirable content and to be able to buy just what is wanted in an a la carte fashion.
After patiently waiting months for Apple to update the first generation of Apple TV to no avail, I noticed they were discontinuing the smaller 40 GB version. The larger version is still smallish, only 160 GB. When the 40GB model was discontinued, the Apple store blew out their remaining refurbished units at a big discount, priced low enough that we bought a 40GB Apple TV plus a 320GB WD notebook drive for less than the cost of the new 160GB Apple TV.
The trick is to swap out the old drive for the new one and to restore the OS, which takes a little effort. When Sean did this a year ago with his Apple TV, the process was slow as the entire 40GB drive needed to be copied using dd, a slow block-by-block copy process that took hours. Resizing the media partion on the drive also was an issue, Sean ended up having to buy iPartion to make it work. It was a complicated process that took all day.
So, while I was waiting for the Apple TV to arrive, I spend some time googling for any newer, better ways to do the brain transplant. Turns out that there is a trick where only the OS (EFI) and recovery partions need to be copied with dd, the media partition can be set to the new size with a factory restore after creating the partition and establishing a file system. The how-to that I followed can be found on the MacRumors site. In case that goes away, here is a fairly terse version of what worked.
Setup
First, set up the Apple TV and make sure that is works and has the latest software. Update the device if needed. Register the Apple TV through iTunes and name the device, but don't let it sync as any content on the original drive isn't going to be moved to the new drive. If you've already been using the Apple TV then you'll want to be sure that all content is safe on another drive somewhere.
Second, take the Apple TV apart. It is pretty straight forward, after peeling the rubber base off (and voiding the warranty!), there are 4 screws (2 different lengths!) to take the base plate off and 4 more to allow the HD to be removed. Once the HD is out you'll need some kind of USB dongle to hook it up to the Macbook. Sean has one of these, and it works really well.
Archive the Original HD
Use Disk Utility to figure out the disk identifier for the Apple TV HD, in this case the HD was disk3, if yours is different, then "disk3" will need to be replaced with the correct disk identifier in the commands below.
Get a listing of the partions on all the drives, pay attention to disk3, see that there are 4 partions:
diskutil list
Make backup copies of the EFI and Apple_Recovery partitions, the dd commands will take a little time, but since the 2 partions are only 434 MB, it's not too long (maybe a minute for the recovery partition):
sudo diskutil umountDisk /dev/disk3 sudo dd if=/dev/disk3s1 of=/Volumes/Blair/atv_efi.dmg bs=1m sudo dd if=/dev/disk3s2 of=/Volumes/Blair/atv_recovery.dmg bs=1m diskutil eject disk3
Set Up the New HD
Now, swap the original HD for the new HD and hook it up to the MacBook. Check the disk identifier (Disk Utility again, or this diskutil commmand:
diskutil list
Mine was disk3 again and showed up as ~300 GB of unpartitioned space, so now the disk is initialized as follows:
diskutil unmountDisk /dev/disk3 sudo gpt create /dev/disk3
Add four partitions to the new disk. These are created with the gpt command which has the following syntax: -b n, start at block n, -i m partition id m, -s q partition size of q blocks. Add the EFI partition:
diskutil unmountDisk /dev/disk3 sudo gpt add -b 40 -i 1 -s 69632 -t efi /dev/disk3
And the Recovery partition (no idea why it has the name 526536f-..., I just followed the directions):
diskutil unmountDisk /dev/disk3 sudo gpt add -b 69672 -i 2 -s 819200 -t 5265636F-7665-11AA-AA11-00306543ECAC /dev/disk3
Create the OS boot partion:
diskutil unmountDisk /dev/disk3 sudo gpt add -b 888872 -i 3 -s 1843200 -t hfs /dev/disk3
Figure out what the required size of the 4th (media) partition is by using the gpt show command to obtain the size (in blocks) of the space remaining on the disk. The first block after the 3 partitions above have been created is 2732072, on the line beginning with this number, the second number is the number of block remaining on the disk. For the WD3200BEVT the number of remaining blocks was 622410343. This will be different on other drives. Add the fourth partiton:
diskutil unmountDisk /dev/disk3 sudo gpt show /dev/disk3 diskutil unmountDisk /dev/disk3 gpt add -b 2732072 -i 4 -s 622410343 -t hfs /dev/disk3
Now the archive copies of the EFI and Apple_Recovery partitions can be restored onto the new HD, the list command at the end shows the results:
diskutil unmountDisk /dev/disk3 sudo gpt show /dev/disk3 sudo dd if=/Volumes/Blair/atv_efi.dmg of=/dev/disk3s1 bs=1m sudo dd if=/Volumes/Blair/atv_recovery.dmg of=/dev/disk3s2 bs=1m diskutil list
Now a slightly confusing part, a file system has to be created on the Media partition, each command to create the file system is preceded by an eject command. Even though it seems that you shouldn't be able to execute a command on an ejected disk, I did the following anyway:
diskutil eject disk3 gpt remove -i 4 disk3 diskutil eject disk3 gpt show disk3 diskutil eject disk3 gpt add -b 2732072 -i 4 -t hfs /dev/disk3 diskutil eject disk3 newfs_hfs -J -v Media /dev/disk3s4 diskutil list diskutil eject disk3
Reassemble and Restore
Install the new HD into the Apple TV chassis, transferring the protective rectangle of foam tape from the old HD to the new one before screwing it into place on the lid. Re-install the lid and stick the rubber base back into place.
Hook up the Apple TV to a TV or monitor and once it boots it will ask to perform a factory restore. Allow the restore and let the device re-boot. Check that the drive size is what you expected (293.79 GB for the WD3200BEVT).
Total time for this upgrade (including a couple side trips!) was about 2 hours. Once this is all done, then the content from iTunes can be synchronized with the Apple TV.
