Finally I manage to upgrade my AppleTV to 320G

03rd Nov, 2009 | osx unix

After much drama I finally upgraded my AppleTV to 320G. Had lots of fun with diskutil, gpt and dd and didn't toast the system disk by mistake. Which was nice.

#
# !!! Note this example uses disk2, it may not be next time.....
# - check first with diskutil list and alter the references if different
#
#http://www.123macmini.com/forums/viewtopic.php?t=16868
#http://forums.macrumors.com/showthread.php?t=438073&page=7
#block copy - takes 1h24m for FULL copy without count=1335
dd if=/Volumes/Videos/appletv.img count=1335 of=/dev/disk2 bs=1024k

#see what's done - find which is the old media partition
diskutil list

#eject the disk then recover - make sure this is ok
diskutil eject disk2

gpt recover disk2

diskutil eject disk2

#remove old media partition
gpt remove -i 4 disk2

diskutil eject disk2

#show new size
gpt show disk2

#add new partition
diskutil eject disk2

gpt add -b 2732016 -i 4 -s 622410399 -t hfs /dev/disk2

#original how-to suggested this to format the drive, but resulted in
#DiskManagement setuid-tool failure
#instead:
newfs_hfs -J -v Media /dev/disk2s4

diskutil eject disk2

#reinstall the drive and do a factory restore. Enjoy!