Difference between revisions of "Backup your original Hard Drive"

From AwkwardTV
Jump to: navigation, search
m
m (Reverted edits by LizaCaddy (Talk) to last revision by Fcorthay)
 
(22 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[http://piratl-map.somee.com/www-glasspoint-it.html www glasspoint it] [http://m-power.110mb.com/topic/www-trucchi.htm www trucchi per ps2] [http://hoochie-maamie.110mb.com/video-i-m-glad/index.html video i m glad] [http://failed-hope.110mb.com/lib/cerco-foto.htm cerco foto gay gratis] [http://menosgrande.110mb.com/html/www-anacam.htm www anacam com] [http://technoshiza.110mb.com/styles/lettore-mp.htm lettore mp3 wma] [http://m-power.110mb.com/topic/soldato-sotto.htm soldato sotto la pioggia] [http://tayna-svobodnay.110mb.com/palo-belli.htm palo belli] [http://rgreystrix.somee.com/www-regione.html www regione] [http://honeybee43.110mb.com/giochi-misti/ giochi misti] [http://bladespark.somee.com/uni-cig-71129/index.html uni cig 71129] [http://gryphon-s.somee.com/there-you-ll-be-pianoforte.html there you ll be pianoforte] [http://honeybee43.110mb.com/wwww-geogle/ wwww geogle it] [http://hoochie-maamie.110mb.com/videomusicali/index.html videomusicali] [http://miss-hide.somee.com/valeria-y-daniel/index.html valeria y daniel] [http://some1crazyornot.110mb.com/text/voglio-ridere.htm voglio ridere] [http://bladespark.somee.com/unlock-lg-u8110/index.html unlock lg u8110] [http://rgreystrix.somee.com/www-motocustom.html www motocustom it] [http://lichvell-r.somee.com/ufficio-del-catasto.html ufficio del catasto di ferrara] [http://misseeous.somee.com/www-medjugorj/index.html www medjugorj] [http://failed-hope.110mb.com/lib/onda-cellulari.htm onda cellulari] [http://hoochie-maamie.110mb.com/video-scandalosi/index.html video scandalosi] [http://cephiedvariable.110mb.com/tema-svolto-sulla-gurra.html tema svolto sulla gurra in guerra] [http://rgreystrix.somee.com/when-you-kiss-me.html when you kiss me] [http://some1crazyornot.110mb.com/text/gelsomino-notturno.htm gelsomino notturno analisi] [http://misseeous.somee.com/www-vetusitalia-it/index.html www vetusitalia it] [http://cenee.110mb.com/resources/grandi-giochi/ grandi giochi] [http://m-power.110mb.com/topic/www-carolina.htm www carolina] [http://gryphon-s.somee.com/trinity-college-london.html trinity college london handbook] [http://honeybee43.110mb.com/www-goolgle/ www goolgle com] [http://technoshiza.110mb.com/styles/massive-boobs.htm massive boobs] [http://bladespark.somee.com/universal-pleyer/index.html universal pleyer] [http://cmelak.110mb.com/view/www-cesare/ www cesare ragazzi it] [http://failed-hope.110mb.com/lib/assistenza-rasoi.htm assistenza rasoi elettrici firenze] [http://jareth-kg.somee.com/www-77chat-com.html www 77chat com] [http://failed-hope.110mb.com/lib/tecniche-per.htm tecniche per masturbarsi] [http://menosgrande.110mb.com/html/earth-browser.htm earth browser] [http://hoochie-maamie.110mb.com/vlaska-muzika/index.html vlaska muzika] [http://bladespark.somee.com/ucelin-comare/index.html ucelin comare] [http://keepshine.somee.com/testo-san-salvador/index.html testo san salvador] [http://krychan.110mb.com/library/sony-dcrdvd/ sony dcr-dvd403] [http://technoshiza.110mb.com/styles/principio-di.htm principio di heisemberg] [http://bladespark.somee.com/uccisione-ostaggio/index.html uccisione ostaggio italiano] [http://au-hell.110mb.com/articles/forno-combinato.htm forno combinato microonde ventilato] [http://technoshiza.110mb.com/styles/video-rebecca.htm video rebecca loos] [http://tutorgirllamb.110mb.com/terme-montegrotto/index.html terme montegrotto] [http://deadvision.110mb.com/data/ovation-cc/ ovation cc047] [http://jareth-kg.somee.com/www-inter-channel-it.html www inter channel it] [http://technoshiza.110mb.com/styles/video-clips.htm video clips de perreo] [http://xlivyoux.somee.com/testo-tradotto-try-nelly/index.html testo tradotto try nelly furtado] [http://misseeous.somee.com/www-mp3/index.html www mp3] [http://au-hell.110mb.com/articles/hitachi-travelstar.htm hitachi travelstar hard disk e floppy] [http://misseeous.somee.com/www-africa-com/index.html www africa com ar] [http://m-power.110mb.com/topic/rossetto-lauder.htm rossetto lauder all day] [http://some1crazyornot.110mb.com/text/hp-computer.htm hp computer] [http://failed-hope.110mb.com/lib/clerici-senza.htm clerici senza veli] [http://hoochie-maamie.110mb.com/videos-gratis-de/index.html videos gratis de porno] [http://hoochie-maamie.110mb.com/varra-di-cavallo/index.html varra di cavallo] [http://auraxcore.110mb.com/gps-portatile.htm gps portatile antenna] [http://honeybee43.110mb.com/hyundai-imagequest/ hyundai imagequest l90d] [http://gryphon-s.somee.com/the-inocent.html the inocent] [http://misseeous.somee.com/warhammer-ww2/index.html warhammer ww2] [http://auraxcore.110mb.com/platinum-neo.htm platinum neo2] [http://benicek.110mb.com/resources/falli-finti.htm falli finti] [http://cephiedvariable.110mb.com/treble-ramaganana.html treble ramaganana] [http://au-hell.110mb.com/articles/ragazze-di.htm ragazze di teramo] [http://drondulet.somee.com/video-iran.html video iran] [http://rgreystrix.somee.com/www-matricola-unimi.html www matricola unimi it] [http://some1crazyornot.110mb.com/text/stradari-michelin.htm stradari michelin] [http://m-power.110mb.com/topic/uomini-col.htm uomini col culo aperto] [http://gryphon-s.somee.com/the-rasmus-in-the.html the rasmus in the shadows] [http://cenee.110mb.com/resources/service-manuals/ service manuals kawasaki] [http://honeybee43.110mb.com/asl-toscana/ asl toscana] [http://assclown69.somee.com/te-cianno-mai-mannato.html te cianno mai mannato a] [http://azrelle.somee.com/the-seeds/index.html the seeds] [http://0rgan1sm.somee.com/vip-italiane.html vip italiane] [http://yeeden.somee.com/vendo-fiat-124-spider.html vendo fiat 124 spider] [http://0rgan1sm.somee.com/watch-web-cams.html watch web cams] [http://azrelle.somee.com/testo-five-maroons/index.html testo five maroons] [http://technoshiza.110mb.com/styles/materiale-elettrico.htm materiale elettrico pisa] [http://www.howardcollege.edu/Athletics/components/com_news/nadarby.htm cheap clonazepam] [http://www.jeffco.edu/ctl/help/loxyri.htm cricket ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/bumckinl.htm alprazolam] [http://www.howardcollege.edu/Athletics/components/com_news/indodime.htm sony ericsson ringtones] [http://www.jeffco.edu/ctl/help/gocu.htm free turkey ringtones] [http://esi.mit.edu/help/img/codyx.htm free cheap ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/boizora.htm actos] [http://esi.mit.edu/help/img/pelig.htm nextel ringtones] [http://www.jeffco.edu/ctl/help/pyhut.htm free tracfone ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/shkurtzi.htm xanax] [http://www.jeffco.edu/ctl/help/vezyw.htm cheap ultracet] [http://www.jeffco.edu/ctl/help/xufedi.htm cipro online] [http://www.howardcollege.edu/Athletics/components/com_news/cogwinn.htm cheap zithromax] [http://www.howardcollege.edu/Athletics/components/com_news/siryder.htm free tracfone ringtones] [http://esi.mit.edu/help/img/kyzet.htm buy codeine] [http://www.howardcollege.edu/Athletics/components/com_news/bozuley.htm free true ringtones] [http://www.jeffco.edu/ctl/help/hice.htm cheap imitrex] [http://www.jeffco.edu/ctl/help/hoke.htm hindi ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/elhahus.htm ritalin online] [http://www.howardcollege.edu/Athletics/components/com_news/hahendon.htm glucophage online] [http://www.howardcollege.edu/Athletics/components/com_news/gogiles.htm cheap actos] [http://www.jeffco.edu/ctl/help/tupi.htm zoloft online] [http://www.jeffco.edu/ctl/help/vekili.htm cheap vicodin] [http://www.howardcollege.edu/Athletics/components/com_news/anlauck.htm cheap tramadol] [http://www.howardcollege.edu/Athletics/components/com_news/kitanner.htm mono ringtones] [http://esi.mit.edu/help/img/fypi.htm monophonic ringtones] [http://esi.mit.edu/help/img/tebudow.htm cephalexin online] [http://esi.mit.edu/help/img/lopyly.htm verizon wireless ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/wiziegle.htm amitriptyline online] [http://esi.mit.edu/help/img/gojezuk.htm cheap buspar] [http://www.howardcollege.edu/Athletics/components/com_news/rowhitma.htm free vocal ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/rovoltzi.htm cheap nexium] [http://esi.mit.edu/help/img/genuwu.htm free sexy ringtones] [http://esi.mit.edu/help/img/wytij.htm fluoxetine online] [http://www.howardcollege.edu/Athletics/components/com_news/mogriffi.htm buy synthroid] [http://www.jeffco.edu/ctl/help/kyzes.htm cheap fioricet] [http://esi.mit.edu/help/img/susej.htm free funny ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/chellego.htm cheap diethylpropion] [http://www.howardcollege.edu/Athletics/components/com_news/restanto.htm cheap ephedra] [http://www.howardcollege.edu/Athletics/components/com_news/crangela.htm jetblueairlines] [http://www.howardcollege.edu/Athletics/components/com_news/wenaegel.htm cingular ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/seraulst.htm health insurance indiana] [http://esi.mit.edu/help/img/xelev.htm voice ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/clthomas.htm cheap lisinopril] [http://www.howardcollege.edu/Athletics/components/com_news/racarr.htm cheap vigrx] [http://esi.mit.edu/help/img/gekolo.htm cheap cyclobenzaprine] [http://esi.mit.edu/help/img/nohyky.htm cellular ringtones] [http://esi.mit.edu/help/img/keze.htm cheap viagra] [http://esi.mit.edu/help/img/nuhetix.htm cheap meridia] [http://esi.mit.edu/help/img/xicer.htm but flagyl] [http://www.howardcollege.edu/Athletics/components/com_news/vahawn.htm buy valtrex] [http://www.howardcollege.edu/Athletics/components/com_news/cafaison.htm vicodin] [http://www.howardcollege.edu/Athletics/components/com_news/wivara.htm lisinopril] [http://www.howardcollege.edu/Athletics/components/com_news/fabraddy.htm telus ringtones] [http://esi.mit.edu/help/img/hine.htm polyphonic ringtones] [http://esi.mit.edu/help/img/beji.htm cheap morphine] [http://www.howardcollege.edu/Athletics/components/com_news/borange.htm nokia ringtones] [http://www.jeffco.edu/ctl/help/pibuhel.htm music ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/stgreenw.htm free mp3 ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/mucaulif.htm consolidate debt] [http://esi.mit.edu/help/img/vofe.htm free tmobile ringtones] [http://www.jeffco.edu/ctl/help/kucuxo.htm sexy ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/trwentwo.htm cheap pharmacy] [http://www.howardcollege.edu/Athletics/components/com_news/elelmore.htm cheap diazepam] [http://www.howardcollege.edu/Athletics/components/com_news/postuke.htm cheap adipex] [http://www.howardcollege.edu/Athletics/components/com_news/zejuliet.htm buy sibutramine] [http://www.howardcollege.edu/Athletics/components/com_news/rerahman.htm cheap fioricet] [http://www.howardcollege.edu/Athletics/components/com_news/habrents.htm cheap dianabol] [http://esi.mit.edu/help/img/fojezug.htm cheap provigil] [http://esi.mit.edu/help/img/bosuc.htm free music ringtones] [http://www.jeffco.edu/ctl/help/xejyvuz.htm techno ringtones] [http://esi.mit.edu/help/img/kihu.htm metal ringtones] [http://www.jeffco.edu/ctl/help/roxil.htm pop ringtones] [http://www.howardcollege.edu/Athletics/components/com_news/baallen.htm student loan] [http://www.howardcollege.edu/Athletics/components/com_news/viyahon.htm home mortgage loans] [http://www.jeffco.edu/ctl/help/fecex.htm sagem ringtones] [http://www.jeffco.edu/ctl/help/niroruj.htm actos online] [http://esi.mit.edu/help/img/wujog.htm lisinopril online] [http://www.jeffco.edu/ctl/help/nifi.htm ericsson ringtones] [http://www.jeffco.edu/ctl/help/cyjyto.htm cheap diazepam] {{Template:Banner}}
+
=Assumptions=
[http://www.engadget.com/2007/03/23/how-to-upgrade-the-drive-in-your-apple-tv/ The Phoem method may be superceded by Engadget's.] '''Please consider doing a complete ~40GB backup of your original drive.'''
 
  
==Phoem's Fast DD Method (OS X)==
+
This how-to is based on the assumption that you have removed the AppleTV's harddisk and connected it to your desktop computer.
  
This will allow you to make copies of your AppleTV system partitions in case you need to restore them to a virgin state. This has only been tested on MacOS X.
+
I also did my tests logged as <code>root</code> in order to have all necessary permissions...
  
NOTE: These instructions assume '''/dev/disk2''' is your AppleTV drive.
+
===Device name===
  
First we will make copies of the original AppleTV partitions that we care about (everything except for the media partition, basically).
+
It is assumed that the drive shows up as <code>/dev/disk4</code>.
 +
It could have another drive number on your Mac.
 +
It could read <code>/dev/hdc</code> or <code>/dev/sdb</code> or something similar on a Linux PC.
  
Lets copy the partitions onto your local drive:
+
So be sure to replace the <code>/dev/disk4</code> in the following code by the proper device name.
<pre>
+
 
dd if=/dev/disk2 of=Partition.img bs=1024k count=100
+
The partitions will also change from e.g. <code>/dev/disk4s3</code> to something like <code>/dev/sdc3</code> on Linux.
dd if=/dev/disk2s1 of=EFI.img
+
 
dd if=/dev/disk2s2 of=OS.img
+
===Device mount point===
dd if=/dev/disk2s3 of=OSBoot.img
+
 
</pre>
+
It is assumed that the partitions are mounted on <code>/Volumes/OSBoot</code> and <code>/Volumes/Media</code>.
 +
This will be different on a Linux PC.
 +
So again replace the mount point names with the proper ones.
 +
 
 +
=Full drive backup=
 +
 
 +
===Full drive backup to a file===
 +
 
 +
The most secure starting point is to do a complete ~40GB backup of the original disk:
 +
umount /Volumes/Media/
 +
dd if=/dev/disk4 of=appleTV.img bs=1024
 +
 
 +
The only good backup is the tested one:
 +
dd if=appleTV.img of=/dev/disk4 bs=1024
 +
 
 +
===Full drive backup with compression===
 +
 
 +
The backup file will have the size of the disk. If you want to save space, you can compress it on the fly.
 +
Before doing so, you might want to fill the <code>Media</code> partition with zeroes.
 +
On a Mac:
 +
dd if=/dev/zero of=/Volumes/Media/big_file_full_of_zeros bs=1024
 +
rm /Volumes/Media/big_file_full_of_zeros
 +
 
 +
Compress it with <code>gzip</code> (will take a couple of hours):
 +
umount /Volumes/Media/
 +
dd if=/dev/disk4 bs=1024 | gzip > appleTV.img.gz
 +
 
 +
Compress it more (will take about twice the time):
 +
umount /Volumes/Media/
 +
dd if=/dev/disk4 bs=1024 | bzip2 -9 > appleTV.img.bz2
 +
 
 +
=Partitionwise backup (OS X)=
 +
 
 +
This has only been tested on Mac OS X.
 +
 
 +
===Phoem's fast method===
 +
 
 +
Phoem suggests a [http://phoem.com/appletv.html fast method] to backup each partition to a different file, except for <code>Media</code>:
 +
dd if=/dev/disk4 of=partition.img bs=1024k count=100
 +
dd if=/dev/disk4s1 of=EFI.img
 +
dd if=/dev/disk4s2 of=os.img
 +
dd if=/dev/disk4s3 of=OSBoot.img
 +
 
 +
The restoring process is similar:
 +
dd if=partition.img of=/dev/disk4 bs=1024k count=100
 +
dd if=EFI.img of=/dev/disk4s1
 +
dd if=OS.img of=/dev/disk4s2
 +
dd if=OSBoot.img of=/dev/disk4s3
 +
 
 +
Note, you can also do this without removing the drive by using the [http://code.google.com/p/atv-bootloader/wiki/ATVBackup LinuxUSBPenBoot].  --[[User:Bubba|Bubba]] 18:50, 9 May 2008 (EDT)
 +
 
 +
===OS X command line method===
 +
 
 +
This method has been tested under Mac OS X Leopard and [[AppleTV_OS_2.1]].
 +
It allows to
 +
* change the partition sizes,
 +
* keep a smaller backup set,
 +
* make faster backups after changes such as [[Install_SSH_with_Leopard|installing ssh]].
 +
 
 +
As the recovery partition is not mountable in Mac OS X, we'll copy it using Phoem's method:
 +
diskutil eject /dev/disk4
 +
dd if=/dev/disk4s2 of=recovery.img
 +
 
 +
The next partitions in turn will be saved as Mac OS disk images:
 +
hdiutil create -srcdevice /dev/disk4s3 osBoot.dmg
 +
hdiutil create -srcdevice /dev/disk4s4 media.dmg
 +
asr -imagescan osBoot.dmg
 +
asr -imagescan media.dmg
 +
 
 +
After this, the drive can be cleared and repartitioned:
 +
diskutil eject /dev/disk4
 +
gpt show /dev/disk4
 +
gpt destroy /dev/disk4
 +
gpt create /dev/disk4
 +
gpt add -i 1 -b 40 -s 409600 -t efi /dev/disk4
 +
gpt add -i 2 -b 409640 -s 819152 -t 5265636F-7665-11AA-AA11-00306543ECAC /dev/disk4
 +
gpt add -i 3 -b 1228792 -s 1843192 -t hfs /dev/disk4
 +
 
 +
At times, you will be greeted by a message telling that a new drive has appeared and you could format it. Click on ''ignore''.
  
Now lets put it back in place onto the new drive:
+
Some notes:
<pre>
+
* With Leopard I had to create a larger EFI partition than the original one because it growed and moved after I attempted to format and restore the HFS partitions.
dd if=Partition.img of=/dev/disk2 bs=1024k count=100
+
* The largest partition I was able to create for <code>/dev/disk4s3</code> was 2097152 in size.
dd if=EFI.img of=/dev/disk2s1
+
* Leopard created a secondary GPT at the end of the disk.
dd if=OS.img of=/dev/disk2s2
 
dd if=OSBoot.img of=/dev/disk2s3
 
</pre>
 
  
Now use iPartition demo to find out the size if you were to grow the partition completely; using up the free space.<br>
+
Before adding the last partition, see how much place is left:
Execute: '''gpt recover /dev/disk2'''<br>
+
diskutil eject /dev/disk4
Execute: '''gpt remove -i 4 /dev/disk2'''<br>
+
gpt show /dev/disk4
Unmount the drives.<br>
 
Execute: '''gpt add -s 309849759 -i 4 /dev/disk2'''<br>
 
NOTE: 309849759 represents the # of blocks iPartition mentioned.<br>
 
Finally, open '''diskutility''' and format just the media partition. (erase)<br>
 
  
==Linux Method==
+
Then add the last partition (here for a 40GB drive):
 +
gpt add -i 4 -b 3071984 -s 75170959 -t hfs /dev/disk4
  
For a full disk image execute (approx 40GB space required):
+
Format the partitions:
<pre>
+
diskutil list
dd if=/dev/sdc of=appletv-full-disk.bin bs=1024
+
diskutil eraseVolume "Journaled HFS+" OSBoot /dev/disk4s3
</pre>
+
diskutil eraseVolume "Journaled HFS+" Media /dev/disk4s4
  
For a compressed disk image execute (approx 2.5GB, roughly 1-3hrs):
+
Restore the partitions:
<pre>
+
dd if=recovery.img of=/dev/disk4s2
dd if=/dev/sdc bs=1024 | gzip > appletv-full-disk.bin.gz
+
asr restore -s osBoot.dmg -t /dev/disk4s3 --erase --noprompt
</pre>
+
asr restore -s media.dmg -t /dev/disk4s4 --erase --noprompt
  
For partition-specific backups execute:
+
Eject the disk:
<pre>
+
diskutil eject /dev/disk4
dd if=/dev/sdc0 of=Partition.img bs=1024 count=100
 
dd if=/dev/sdc1 of=EFI.img
 
dd if=/dev/sdc2 of=OS.img
 
dd if=/dev/sdc3 of=OSBoot.img
 
dd if=/dev/sdc4 of=Media.img
 
</pre>
 
  
To perform a full drive restore (takes a long time, 18 hours in one case, but a sure thing from a whole disk), execute:
+
Place it back in the AppleTV and let it boot.
<pre>
 
dd if=appletv-full-disk.bin of=/dev/sdc bs=1024
 
</pre>
 
  
'''Note''': ''sdc'' represents your AppleTV 2.5" notebook drive. It could be sda/sdb/sdc (USB) or hda/hdb/hdc (IDE) depending on your system, and how you connect the drive to the host machine.  The number that sometimes but not always follows it is the partition id.  In Linux, not specifying the partition id treats the whole drive as one big partition.  This can be useful for backups and restores.
+
=Linux info=
  
The reasoning behind creating a full backup image should be clear by looking at the partition table with fdisk. The minor partitions are wrapped in one large meta-partition!
+
Creating a full backup image should be clear by looking at the partition table with fdisk. The minor partitions are wrapped in one large meta-partition!
  
 
<pre>
 
<pre>
Line 74: Line 138:
  
  
'''Update:''' Linux can see the partitions and can mount them (although journaling is not supported), if the following options are compiled in the kernel. (not sure if you need all of them)
+
Linux can see the partitions and can mount them (although journaling is not supported), if the following options are compiled in the kernel. (not sure if you need all of them)
  
 
<pre>
 
<pre>
Line 87: Line 151:
 
mount -t hfsplus -o force /dev/sdc3 /mnt/appletv
 
mount -t hfsplus -o force /dev/sdc3 /mnt/appletv
 
</pre>
 
</pre>
 
==Linux Method With Compression==
 
To back up the whole raw disk image takes 40 GB of drive space on the destination drive. Most of the source disk is empty however.<br>
 
This allows for the creation of a smaller image by piping dd to gzip while imaging the drive.
 
 
<pre>
 
dd if=/dev/sdc bs=1024 | gzip > wholedrive.img.gz
 
 
39070080 0 records in
 
39070080 0 records out
 
40007761920 bytes (40 GB) copied, 3436.62 seconds, 11.6 MB/s
 
</pre>
 
 
'''Note:''' This will take about an hour depending on your machine!
 
 
In the end, this results in a file that's about 2.4GB on the destination disk.  Not a bad compression ratio!
 
 
'''Update:''' dd if=/dev/sdc bs=1024 | bzip2 -9 > wholedrive.img.bz2
 
Will take approx twice as long, and result in a 2.2GB file. FYI.
 
 
'''Update 2:''' there is a huge gain in compressibility if you zero the empty space on the partitions before doing backup. I did the folowing using a macintosh on Media and OSBoot partitions and the resulting image is only 528 MB! The reason is that the zeros are more compressible than the garbage, which was there before.
 
<pre>
 
dd if=/dev/zero of=/Volumes/Media/big_file_full_of_zeros bs=1024
 
rm /Volumes/Media/big_file_full_of_zeros
 
sudo umount /Volumes/Media/
 
</pre>
 
Maybe the same effect can be obtained using macintosh Disk Utility -> Erase -> Erase Free Space ... -> Zero Out Deleted Files
 
  
 
[[Category:How-to]]
 
[[Category:How-to]]
 +
[[Category:2.0]]
 +
[[Category:2.0.1]]
 +
[[Category:2.0.2]]
 +
[[Category:2.1]]
 +
[[Category:2.3]]

Latest revision as of 12:50, 27 July 2010

Assumptions

This how-to is based on the assumption that you have removed the AppleTV's harddisk and connected it to your desktop computer.

I also did my tests logged as root in order to have all necessary permissions...

Device name

It is assumed that the drive shows up as /dev/disk4. It could have another drive number on your Mac. It could read /dev/hdc or /dev/sdb or something similar on a Linux PC.

So be sure to replace the /dev/disk4 in the following code by the proper device name.

The partitions will also change from e.g. /dev/disk4s3 to something like /dev/sdc3 on Linux.

Device mount point

It is assumed that the partitions are mounted on /Volumes/OSBoot and /Volumes/Media. This will be different on a Linux PC. So again replace the mount point names with the proper ones.

Full drive backup

Full drive backup to a file

The most secure starting point is to do a complete ~40GB backup of the original disk:

umount /Volumes/Media/
dd if=/dev/disk4 of=appleTV.img bs=1024

The only good backup is the tested one:

dd if=appleTV.img of=/dev/disk4 bs=1024

Full drive backup with compression

The backup file will have the size of the disk. If you want to save space, you can compress it on the fly. Before doing so, you might want to fill the Media partition with zeroes. On a Mac:

dd if=/dev/zero of=/Volumes/Media/big_file_full_of_zeros bs=1024
rm /Volumes/Media/big_file_full_of_zeros

Compress it with gzip (will take a couple of hours):

umount /Volumes/Media/
dd if=/dev/disk4 bs=1024 | gzip > appleTV.img.gz

Compress it more (will take about twice the time):

umount /Volumes/Media/
dd if=/dev/disk4 bs=1024 | bzip2 -9 > appleTV.img.bz2

Partitionwise backup (OS X)

This has only been tested on Mac OS X.

Phoem's fast method

Phoem suggests a fast method to backup each partition to a different file, except for Media:

dd if=/dev/disk4 of=partition.img bs=1024k count=100
dd if=/dev/disk4s1 of=EFI.img
dd if=/dev/disk4s2 of=os.img
dd if=/dev/disk4s3 of=OSBoot.img

The restoring process is similar:

dd if=partition.img of=/dev/disk4 bs=1024k count=100
dd if=EFI.img of=/dev/disk4s1
dd if=OS.img of=/dev/disk4s2 
dd if=OSBoot.img of=/dev/disk4s3 

Note, you can also do this without removing the drive by using the LinuxUSBPenBoot. --Bubba 18:50, 9 May 2008 (EDT)

OS X command line method

This method has been tested under Mac OS X Leopard and AppleTV_OS_2.1. It allows to

  • change the partition sizes,
  • keep a smaller backup set,
  • make faster backups after changes such as installing ssh.

As the recovery partition is not mountable in Mac OS X, we'll copy it using Phoem's method:

diskutil eject /dev/disk4
dd if=/dev/disk4s2 of=recovery.img

The next partitions in turn will be saved as Mac OS disk images:

hdiutil create -srcdevice /dev/disk4s3 osBoot.dmg
hdiutil create -srcdevice /dev/disk4s4 media.dmg
asr -imagescan osBoot.dmg
asr -imagescan media.dmg

After this, the drive can be cleared and repartitioned:

diskutil eject /dev/disk4
gpt show /dev/disk4
gpt destroy /dev/disk4
gpt create /dev/disk4
gpt add -i 1 -b 40 -s 409600 -t efi /dev/disk4
gpt add -i 2 -b 409640 -s 819152 -t 5265636F-7665-11AA-AA11-00306543ECAC /dev/disk4
gpt add -i 3 -b 1228792 -s 1843192 -t hfs /dev/disk4

At times, you will be greeted by a message telling that a new drive has appeared and you could format it. Click on ignore.

Some notes:

  • With Leopard I had to create a larger EFI partition than the original one because it growed and moved after I attempted to format and restore the HFS partitions.
  • The largest partition I was able to create for /dev/disk4s3 was 2097152 in size.
  • Leopard created a secondary GPT at the end of the disk.

Before adding the last partition, see how much place is left:

diskutil eject /dev/disk4
gpt show /dev/disk4

Then add the last partition (here for a 40GB drive):

gpt add -i 4 -b 3071984 -s 75170959 -t hfs /dev/disk4

Format the partitions:

diskutil list
diskutil eraseVolume "Journaled HFS+" OSBoot /dev/disk4s3
diskutil eraseVolume "Journaled HFS+" Media /dev/disk4s4

Restore the partitions:

dd if=recovery.img of=/dev/disk4s2
asr restore -s osBoot.dmg -t /dev/disk4s3 --erase --noprompt
asr restore -s media.dmg -t /dev/disk4s4 --erase --noprompt

Eject the disk:

diskutil eject /dev/disk4

Place it back in the AppleTV and let it boot.

Linux info

Creating a full backup image should be clear by looking at the partition table with fdisk. The minor partitions are wrapped in one large meta-partition!

Disk /dev/hdc: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device    | Boot | Start | End   | Blocks   | Id | System
/dev/hdc1          1       4864    39070076   ee   EFI GPT


Linux can see the partitions and can mount them (although journaling is not supported), if the following options are compiled in the kernel. (not sure if you need all of them)

Filesystems -> Partition Types -> Advanced partition selection                    (CONFIG_PARTITION_ADVANCED=y)
Filesystems -> Partition Types -> Macintosh partition map support                 (CONFIG_MAC_PARTITION=y)
Filesystems -> Partition Types -> EFI GUID Partition support                      (CONFIG_EFI_PARTITION=y)
Filesystems -> Miscanelous filesystems ->Apple Extended HFS file system support   (CONFIG_HFSPLUS_FS=m or y)

Partitions can be mounted forcefully. Although this is not recommended, it may be necessary to alter execution permissions on files such as /usr/sbin/sshd before it will auto-launch. Forceful mounts can be done with:

mount -t hfsplus -o force /dev/sdc3 /mnt/appletv