Upgrading Apple TV's hard drive
Likely the most common complaint I've heard about the Apple TV in its thus-far-short life is that the included hard drive is too small. With movies from the iTunes Store weighing in at around 1.5GB, and hour-long TV shows around 500MB, the Apple TV's 40GB hard drive—which gives you only 33GB or so of actual storage space—fills up quickly, especially if you also want to store music and photos on it.
As it turns out, and as I mentioned earlier this week in my "Hacking Apple TV" article, upgrading the Apple TV's hard drive isn't all that difficult—several Web sites had written about the procedure within days of the first units rolling off the assembly lines. The process likely voids your warranty, and requires some hardware disassembly and a few trips through Terminal, but unlike, say, dismantling a MacBook Pro, upgrading the Apple TV's drive is a reasonable task for most people. (If you aren't the adventurous type, two companies have already announced for-fee drive-swapping services.)
I had hoped to perform this storage surgery as soon as I received my Apple TV, but when I first opened it up, I discovered that the drive inside wasn't a 2.5-inch SATA drive, like those used in all recent Apple laptops (and of which I had several sitting around), but rather an ATA drive—making this the only Apple product, other than the 5th-generation iPod, still using ATA. So I had to get a new drive. I ended up ordering a HITACHI Travelstar 5K160, a 160GB drive (5400rpm, 8MB cache, as compared to the stock drive's 4200rpm, 2MB cache) that's advertised as low-power and cool-running (the latter being a desirable feature given that the Apple TV can get hot while in use). The price was a reasonable $110.
The following how-to assumes your Mac is running Tiger (Mac OS X 10.4), as some of the Terminal tools used aren't present in earlier versions of Mac OS X.
As I noted in my earlier article, Apple hasn't made it difficult to get inside the unit. The biggest obstacle—and it's more a psychological one than a physical one—is that the large rubber "foot" that covers the entire bottom of the Apple TV is attached via adhesive; once you remove it, it does't re-adhere very well, so it will be obvious that you've tinkered with your new toy (hence my warning about voiding your warranty, above). Functionally, though, this isn't much of an issue; when you're done with the upgrade, the Apple TV rests perfectly on top of the rubber foot, even if it's not permanently attached. (And if you're careful, you'll peel it back only about halfway during the process.)
To perform hard-drive surgery on the Apple TV requires removing eight screws on the bottom of the unit; you'll need a couple Torx-style screwdrivers to do so. The first four are at the four corners of the base; you simply peel each corner back slightly and then remove each screw with a Torx 10 screwdriver (you can also use the more-common Torx 8 size, necessary for removing the hard drive, in a pinch). This detaches the bottom of the Apple TV from the rest of the unit; if all you want to do is peek inside, you can now lift up the bottom to look. (Two tips: First, put a towel or similarly-soft layer under your Apple TV to avoid damaging the unit's easily-scratchable top surface. Second, keep track of which screw goes where, since the two closest to the front of the Apple TV are longer than the two near the back.)
To release the hard drive—it's connected to the base—you've got four more screws to remove and, unfortunately, they're not in the corners—which means peeling back more of the adhesive foot. However, the drive is located flush against the front edge of the Apple TV, so you don't need to remove the entire foot; just peel it back three inches or so until you see all four hard-drive screws. A Torx 8 screwdriver will let you remove these.
Lift up the bottom of the Apple TV and you'll find that the hard drive, despite being unscrewed, is still "attached." That's because there's an adhesive pad keeping it in place; a gentle tug should release it.
You'll also need to remove a small adhesive pad from the front of the drive. Both are reusable, so you can put them on your new drive when you're ready to install it. Unplug the ATA connector cable from the drive and you're ready for the next stage.
Preparing the new drive
The process of upgrading your hard drive involves making the new drive look—to the Apple TV—just like the original one. This means that the first thing you need to do is connect the original drive to your Mac so you can copy its contents. Since the drive is a standard 2.5-inch ATA drive, any external hard-drive enclosure or cable adapter (such as Newer's Universal Drive Adapter) will work. I opted to purchase MacAlly's 2.5" USB 2.0 Mac External Storage Enclosure, which was only $12 when purchased with the new drive from NewEgg.com.
Tip: When you connect your Apple TV drive to your Mac, Spotlight will want to index its volumes (described below), which creates Spotlight index files on each volume. I don't know if these files will do any harm, but you probably don't want them. I used Spotless to disable Spotlight on these volumes—for both the old drive and the new one—and to delete any Spotlight files that might have been created on either drive between the time I plugged that drive in and the time I disabled Spotlight for it. (You could isntead drag each volume to the Privacy list in the Spotlight pane of System Preferences, which should prevent Spotlight from indexing those volumes, but this feature doesn't always work well.)
Note: While you've got the Apple TV's hard drive connected, feel free to do some exploring—just don't make any changes or add or delete any files. You'll find that the OSBoot partition is really just a Mac OS X volume, with slight modifications for the Apple TV. Inside the Media partition is a Media folder, where all of your media is stored, and a Scratch folder that contains, among other things, the user account, frontrow, that's automatically logged in when you start up your Apple TV. (You'll even find odd legacy files in here, such as Internet Explorer's default bookmarks file!) Dive down into /Volumes/OSBoot/System/Library/CoreServices/Finder.app—which is actually the Apple TV's Front-Row-like interface—and you'll find /Contents/Screen Savers, which contains the three screen-saver plugins offered in the Apple TV's Settings screen; how long before someone creates new screensavers you can drop in here?. You'll also find, by snooping through various preferences files, that the Apple TV's project name was apparently "Riptide."
Once the Apple TV's drive is connected to your Mac, you'll see two new volumes in the Finder, OSBoot and Media. But the drive actually has other partitions. If you launch Terminal and type
diskutil list and then scroll to the Apple TV drive's listing, you'll see something like this:
/dev/disk4 #: type name size identifier 0: GUID_partition_scheme *37.3 GB disk4 1: EFI 34.0 MB disk4s1 2: 400.0 MB disk4s2 3: Apple_HFS OSBoot 900.0 MB disk4s3 4: Apple_HFS Media 36.0 GB disk4s4
The above partition listing presents a bit of a problem: multiple partitions means you can't just "clone" the stock drive to your new drive using a utility such as SuperDuper and then install the new one in the Apple TV. (Well, you could, but you'd have to first repartition the new drive to match the partition layout of the original and then clone each partition separately—a messy process.)
Instead, we'll use the
dd command in Terminal. This utility can duplicate an entire device (such as a hard drive), including all partition information. It can also copy a disk or device to a local file, which is helpful if you have only a single drive enclosure or cable. In fact, that's the process I'm going to describe here: to copy the original Apple TV drive to an image file on your Mac's hard drive and then later copy that image to the new Apple TV hard drive. Here are the steps; note that you'll need around 37GB of free space on your Mac's hard drive for temporarily storing the image file:
- In the
diskutil listoutput noted above, find the listing for your original Apple TV’s hard drive; note the part that says /dev/disk# (mine, above, is /dev/disk4, but yours may be disk2, disk3, or another number).
- In Terminal, type
dd if=/dev/disk# of=/Users/Shared/AppleTVImage.dmg bs=1m, where /dev/disk# is the identifier you determined in the previous step. This command creates the image file, which I’ve named AppleTVImage.dmg in your Shared folder; you could change that path to any location on your drive you prefer. If you don’t have room on your main hard drive but have another drive connected that does have the necessary space, instead use the command
dd if=/dev/disk# of="/Volumes/[name of volume with free space]/AppleTVImage.dmg" bs=1m, where [name of volume with free space] is the name of the volume on which you’re storing the temporary disk image. If you’re curious about the structure of the command being used, if means “input file,” of means “output file,” and bs is “block size” (the amount of data copied at once); 1m tells the command to copy in 1MB chunks, which should be much faster than copying block-by-block. Even so, this process can take a long time, since you’re copying every block of a 40GB drive; you may want to start it before you go to bed at night.
- Once the previous process is finished—you’ll see the command prompt reappear in Terminal, along with a summary of how much data was copied and the time it took—you can unmount the Media and OSBoot volumes and then disconnect the original Apple TV drive.
- Connect the new drive to your Mac using the same enclosure or cable; if you get OS X’s “unrecognized volume” dialog, simply click on Ignore.
diskutil listagain to verify the device number of the new drive (it will likely be the same as the previous one, but just in case).
- Use the
ddcommand again to copy the image file you created to the new drive:
dd if=/Users/Shared/AppleTVImage.dmg of=/dev/disk# bs=1m(or
dd if="/Volumes/[name of volume]/AppleTVImage.dmg" of=/dev/disk# bs=1mif you saved the image to a different drive), where # is again the disk identifier.
- Wait (again).
- When the process is finished—again, you’ll see the command prompt reappear in Terminal—the Media and OSBoot partitions for your new drive should automatically appear in the Finder.
Note: As I mentioned, the above procedure can take a long time, since you're copying every block—twice (once from the original drive to the disk image, once from the disk image to the new drive). For example, the copy from the original drive to the image file on my Mac took just over eight hours; the copy from the image file to the new disk took just as long. A must faster procedure, though one that's much more technical in nature, is also available. (An even shorter version, which requires a bit more technical knowledge on the part of the user, is here.)
Note: If you happen to have two drive enclosures or cables, so you're able to connect both the old and new drives simultaneously, the above procedure is a bit simpler, since you can copy the old drive directly to the new one. After using
diskutil list to find the device number of each drive, use the following Terminal command:
dd if=/dev/disk# of=/dev/disk# bs=1m, where the first disk# is the device number of the original Apple TV drive and the second disk# is the number of the new drive. This should cut the overall copy time in half.
At this point, you can delete the AppleTVImage.dmg file from your Mac's hard drive if you like. However, if you can spare the space, you might want to keep the image around for a while, just in case something goes wrong during the next few steps. The image file can also be useful if you plan on experimenting with your Apple TV; at any time, you can restore your Apple TV back to "new" status by erasing the new Apple TV hard drive and restoring it from the image file.
The joys of repartitioning
You might think you're ready to stick the new drive into your Apple TV at this point, but there's one problem: The new drive's partitions are exactly the same size as those of the original. In other words, right now, your new drive appears to be a 40GB drive. (Go ahead, do a Get Info on the new Media partition and you'll find that it's only 36GB.) Where did all that extra space you paid good money for go? It's there, but it isn't (yet) being used. You need to repartition the drive—meaning rearrange the drive's segments—so that the Media partition includes the extra space.
I recommend using Coriolis Systems's $50 iPartition for this step if you've got some cash to spare (or already have the utility). After launching iPartition and choosing the new drive from the app's list of drives, you'll see a pie chart of the drive's partitions, including all unused space in gray. You simply drag the edge of the Media "piece" of the pie so that it encompasses all that gray area and then click the Commit button in the toolbar. In a matter of seconds, your Media partition is its rightful size. And because there was no data on that free space, you don't even have to worry about losing data—generally one of the risks of repartitioning a drive. (If you've already got a copy of Prosoft's Drive Genius or Micromat's DiskStudio sitting around, these utilities also let you repartition a drive without reformatting it.)
If you don't already have a partitioning utility, and you don't feel like springing for one, the process is still doable, but a bit more complicated (and perhaps a bit intimidating if you're not comfortable with Terminal). Here are the steps; if at any time you see the Finder's "unrecognized volume" error, click on Ignore:
1. In Terminal, type
diskutil list yet again to be sure you’re working with the correct drive and partition; once you’ve found the drive, look for the partition on that drive that says “Apple_HFS Media.” Note the device number (on my drive, disk4) and the partition number (the number farthest to the left, 4 on my drive).
diskutil eject disk# (where # is, again, the device number). This ejects the new Apple TV drive so you can work with its partitions.
gpt remove -i ## disk#, where ## is the partition number and # is, again, the device number. For example for my disk, the command would be
gpt remove -i 4 disk4. This command deletes the current Media partition. (If you’re curious,
gpt is the GUID partition table utility.)
diskutil eject disk# again. (You need to eject the disk before using the gpt command each time. A hassle, but necessary.)
gpt show disk#, where # is, again, the device number of the drive. This command shows you the current partition layout of the drive; here’s the output for my drive:
start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 34 6 40 69632 1 GPT part - C12A7328… 69672 819200 2 GPT part - 5265636F… 888872 1843200 3 GPT part - 48465300… 2732072 312581775 312581775 32 Sec GPT table 312581807 1 Sec GPT header
You’ll notice one very large empty area; that’s the space that’s currently unused. On my drive, it starts at block number 2732072 and is 312581775 blocks in size. (In the output above, I’ve shortened the contents column for index 1, 2, and 3 to fit this page; you’ll see much longer strings of characters there.)
diskutil eject disk# to eject the disk again.
gpt add -b _START_ -i 4 -s _SIZE_ -t hfs /dev/disk#, where START is the starting block of the free space (2732072 for my disk, above) and SIZE is the size of that space (312581775 for me). This command tells
gpt to create a new partition, partition #4, starting at block number START and ending after SIZE blocks.
diskutil eraseVolume "Journaled HFS+" Media /dev/disk#s4 (# is the device number, 4 is the new partition number). This command formats the new, larger Media partition so that it’s ready for use.
Whew! Your Media partition should reappear in the Finder; Get Info on it to see its new, more spacious size. In my case, nearly 148GB. (The free space is less because I performed my upgrade after having synced data from iTunes to the original drive, and I used iPartition to resize the Media partition; so my original data was preserved. If you used the Terminal method to repartition, your Media volume will be empty.)
Putting it back together
Now it's time to put your Apple TV back together again, a fairly painless process. First, connect the ATA cable to the new drive. Then place the two adhesive pads on the drive in the same locations from which you removed them from the original drive: the large double-stick pad goes on the bottom (the side with the four mounting-screw holes), the small pad goes in the lower-right corner.
Gently press the drive against the Apple TV's bottom plate so that the drive's four mounting-screw holes line up with the four holes on the bottom plate; then replace the four Torx-8 screws and tighten them. Finally, replace the bottom plate and fasten it in place with the four Torx-10 screws.
Connect the Apple TV's power and connection cables (the latter I'm assuming are already hooked up to your TV), and the Apple TV should start up normally. If it doesn't, don't worry—there's one more step you should take, regardless of whether or not the new drive works right away. I recommend using the Apple TV's Restore feature to reset your Apple TV back to its original configuration. If you'd previously been using your Apple TV, this means you'll have to go through the setup process again, including re-syncing your media, but the Restore process ensures that your new drive is in like-new working order.
To perform a restore, hold down the Menu and Down (-) buttons simultaneously for approximately six seconds; you'll eventually see the Apple TV's status light blink off and then on again. This will bring up the language-selection screen, and then the Apple TV Recovery screen, which gives you options to Restart, Run Diagnostics, or perform a Factory Restore.
Select Factory Restore and press the Play button; confirm your selection on the next ("Are you sure?") screen and the restore process will begin. It should take only a few minutes; you'll see a progress dialog on the screen during the process. Once the restore is complete, the Apple TV will restart, the initial startup movie will play, and the setup process will begin.
Once you've completed setup, go to the Apple TV's Settings menu, and then choose About; assuming all went well, the Capacity should now reflect the larger size of your new drive!
You should also see this new, larger size in the Summary screen of iTunes' Apple TV display. For example, here's mine just after syncing started: