I purchased an AppleTV when they first came out as it was perfect for playing all the kids movies which were on DVD's that were becoming increasingly scratched and getting lost. Sadly I discovered that the internal drive was less than adequate to hold them all, but luckily I have a house server running all the time anyway for XTension anyway so setting up streaming was no big deal. The interface for finding the streamed videos is less than perfect and the kids sometimes have trouble finding things but it does work. Lately though I've taken to lugging the AppleTV along with us on vacations and trips to hook to hotel or relatives TV's so it's necessary now to get as much of that stored locally as possible. The disk drive inside is a regular 2.5" IDE (note: NOT SATA) drive and can be fairly easily replaced physically by anybody with a set of torx drivers. Other people online have described it as stuck to the case via a pice of foam tape like stuff that was easy to remove. Mine was NOT easy to remove. After removing the screws it stayed stuck tight so much so that I was worried about damaging the drive to pry it loose. I finally resorted to using a small screwdriver to push through the mounting holes one after another working around and around until it finally came loose. Save that piece of foam as you'll need it when replacing the next drive to keep the metal case from shorting against the bottom of the disk controller board if it should flex at all. Now the problems started. the disk has a very interesting partition setup that cannot be easily re-created or altered with the regular OSX partitioning tools. If you simply image the entire disk via the "dd" command as engadget and others suggest and restore to a larger disk then disk utility will refuse to resize the Media partition as the partition table is too small to allow it. If you use "gpt" from the command line as they suggest it will do it, but it will create a corrupt partition that overlaps other data and the disk will become corrupt and have to be reformatted. What I finally had to do was to image the individual partitions on the disk separately, manually from the command line create the appropriate partitioning on the new disk and then restore the images to it. this is not complicated really, just involves some typing at the command line, but if you do these things to the wrong disk you will totally destroy whatever disk is connected to your system. So be sure to follow those instructions to make sure you're working on the right disk! First thing to do is to connect the original AppleTV disk to your Mac via some kind of IDE to USB or Firewire adaptor. I used an old firewire portable case that used to hold the disk I was replacing it with. When you connect the old drive 2 partitions will mount on the desktop, "OSBoot" and "Media" for this example I'm not going to preserve the "Media" directory, but you can do that if you wish to save whats on it, I decided that would take too long and just resynced over night after I got it working again. In addition to the 2 mounted partition the disk has 2 others that need to be imaged and moved to the new disk. The first partition is called "EFI" and is the firmware or bootloader or other such. The second holds the factory restore information so that you can boot into restore mode and rebuild the OSBoot partition if that ever becomes corrupted. You do not actually HAVE to restore the restore partition, the machine will run without it, but you'll be sunk if you ever need it. The finder will continue to remount the OSBoot and Media partitions as we work so you'll have to eject them after about every step or get errors that the disks are in use.
Step 1: figure out what the disk entry is
If you have only 1 disk on your system, and no images or other things mounted then your boot disk will be called disk0 and the newly mounted apple tv disk will be called disk1. If you have other disks mounted first they will get the lower numbers. You can figure out for sure what the disk number is by running the command diskutil list in the terminal. The output will look something like this:
[pasta:~] james% diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *465.8 Gi disk0
1: EFI 200.0 Mi disk0s1
2: Apple_HFS Meteor 465.4 Gi disk0s2
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *298.1 Gi disk1
1: EFI 200.0 Mi disk1s1
2: Apple_HFS BigMedia 297.8 Gi disk1s2
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *37.3 Gi disk2
1: EFI 34.0 Mi disk2s1
2: Apple_Recovery 400.0 Mi disk2s2
3: Apple_HFS OSBoot 900.0 Mi disk2s3
4: Apple_HFS Media 35.8 Gi disk2s4
in my case the /dev/disk2 entry is the AppleTV disk, you can see 4 partitions listed, EFI, Apple_Recovery, Apple_HFS OSBoot and Apple_HFS Media. The whole disk is mounted as disk2 in my case, and the other partitions are given names like disk2s1, disk2s2 etc... we're going to make images of the EFI, recovery and OSBoot partitions next given the disk number as 2.
Step 2: Image the necessary partitions
image the EFI Partition:
dd if=/dev/disk2s1 of=./efi.dmg bs=1024k
dd if=/dev/disk2s1 of=./efi.dmg bs=1024k
saves the entire partition to a disk image file called efi.dmg in the current working directory, you can change that path if you'd like it somewhere else.
Image the apple recovery partition:
dd if=/dev/disk2s2 of=./recovery.dmg bs=1024k
image the OSBoot partition:
dd if=/dev/disk2s3 of=./osboot.dmg bs=1024k
Step 3: Partition the new disk
diskutil eject disk2
now we're going to totally wipe out the partition table on this new disk and start from scratch: gpt destroy /dev/disk2and create a new partition table:
gpt create /dev/disk2
Create the EFI partition:
gpt add -b 40 -i 1 -s 69632 -t efi /dev/disk2
eject the disk again if necessary Create the recovery partition. This one is odd, I dont know if it's actually necessary to give it the same ID number as in the examples, but doing it this way did work so thats what I'll pass on again:
gpt add -b 69672 -i 2 -s 819200 -t 5265636F-7665-11AA-AA11-00306543ECAC /dev/disk2
gpt add -b 69672 -i 2 -s 819200 -t 5265636F-7665-11AA-AA11-00306543ECAC /dev/disk2
eject the disk again Create the OSBoot Partition:
gpt add -b 888872 -i 3 -s 1843200 -t hfs /dev/disk2
eject the disk again create the new Media partition. This is the one that you need to calculate the size of to use the whole new disk. Thats not hard to do though as the size of the empty space can be shown by the gpt command. So at this point show the partitions on the disk:
gpt show /dev/disk2
the output will look something like:
gpt add -b 2732016 -i 4 -s 309849759 -t hfs /dev/disk2
gpt show disk1 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-F81F-11D2-BA4B-00A0C93EC93B 69672 819152 2 GPT part - 5265636F-7665-11AA-AA11-00306543ECAC 888824 1843192 3 GPT part - 48465300-0000-11AA-AA11-00306543ECAC 2732016 309849759 312581775 32 Sec GPT table 312581807 1 Sec GPT header
see the 3 indexed "GPT parts" and following that an empty line before the "sec GPT Table" that is where we'll get our start and size parameters for creating the full sized media partition. So in my case as above the -b (begin) parameter is 2732016 and the -s (size) parameter would be 309849759. So the command would be:gpt add -b 2732016 -i 4 -s 309849759 -t hfs /dev/disk2
Since we're not restoring the media partition we need to reformat it as a standard HFS+ volume and we can do that here, eject the disks first though "diskutil eject disk2”
newfs_hfs -J -v Media /dev/disk2s4
Step 4: Restore the image files
we need to put back the data from the efi, apple recovery and osboot partitions. We made the partitions above but they are empty so we'll put those image files we made in step 2 back into them. If you used different names for the dmg files we created above or put them in a different place you'll have to use the appropriate names and paths different from the example below. First the efi partition:
dd if=./efi.dmg of=/dev/disk2s1 bs=1024k
eject the disks again "diskutil eject disk2" Then the apple recovery partition:
dd if=./recovery.dmg of=/dev/disk2s2 bs=1024k
eject the disks again "diskutil eject disk2" Finally the OSBoot partition:
dd if=./osboot.dmg of=/dev/disk2s3 bs=1024k
Step 5: Remove the Spotlight Index Files
Spotlight will try to index these new disks as they are mounted. It will create files at the root level of each one called ".Spotlight-vt100" and you need to delete those. You can do it from the finder by turning on the show invisibles option and just dragging them to the trash (it may ask you for your password) or you can do it from the command line by switching to those directories like cd /Volumes/OSBoot and then doing
rm -R ./Spotlight-vt100
(notes from the future: That AppleTV is still running happily and I plan to keep it for as long as it will keep running. The older AppleTV models have a couple of advantages over the new ones not including the onboard disk drive. You can hack them to watch hulu content and they have component video output instead of HDMI. You can set the output to 480i which is just component standard resolution video. So if you have an older TV that you still have somewhere that has component inputs then you can use this to play movies on it. We have one older TV that is so heavy that I couldn’t carry it out to throw it away if I wanted to, this lets me put off the inevitable a little longer.)
No comments:
Post a Comment