Irgendwie würde ich die Komponenten von Mac OS X bestenfalls als unvollständig, schlechtestens als bösartiges Bug-Sammelsurium-in-Progress bezeichnen.

Das ist besonders relevant für die Partitionierung von Festplatten. Ich hatte mit meinem MBP 15 aus 2010 ein Problem wie in  „[Lion randomly Crashs – black screen]“ beschrieben. Kurzum, ich entschied mich, die originale Festplatte in mein Notebook zu bauen und OS X Lion neu zu installieren – und zwar so sauber, wie es nur geht.

Gesagt, getan, an anderer Stelle mehr zu dem Vorgang und seinen Ergebnissen. Hier beschränke ich mich auf Ausführungen zur Festplattenvorbereitung. Nur soviel: Ich konnte innerhalb von zwei Wochen trotz aktiver Schändung des Systems (Ruhezustand, Aufwecken, USB an/aus/an/aus, Batterienutzung, Stromnutzung…) auf einer anderen Festplatte kein Problem entdecken und wollte daher wieder auf die große Festplatte – vor allem der Bootcamp-Partition wegen, die aber wiederum auf der großen Festplatte drauf war, die ich zwar gesichert, aber mittlerweile überschrieben hatte (sicher löschen? j).

Vorweg: Zwei Images von Partitionen auf der großen Festplatte hatte ich erstellt. HFS+-Partitionen über SuperDuper in ein Sparse Image Bündle, die Bootcamp-Partition klonte ich mit partclone über clonezilla.

Ich fahre also mit einer Sicherung der internen Festplatte über GigE fort:

Administrators-MacBook-Pro:Volumes root# dd if=/dev/disk0 bs=50000000 | ssh root@server.intern ‚cat /media/Backups/Backup_NewLion.dd‘

root@server’s password:

0+7713718 records in

0+7713718 records out

500107862016 bytes transferred in 9234.678188 secs (54155419 bytes/sec)

Dann baute ich die große Festplatte zurück (Anleitungen dazu gibt es zuhauf, z.B. bei iFixit) und spielte das Image der Festplatte zurück mittels:

Administrators-MacBook-Pro:Volumes root# ssh root@server.intern ‚cat /media/Backups/Backup_NewLion.dd‘ | dd of=/dev/disk0 bs=50000000

root@server’s password:

0+7713718 records in

0+7713718 records out

500107862016 bytes transferred in 9234.678188 secs (54155419 bytes/sec)

Das ergab folgende Aufteilung:

Administrators-MacBook-Pro:Volumes root# diskutil list disk0

/dev/disk0

#:                       TYPE NAME                    SIZE       IDENTIFIER

0:      GUID_partition_scheme                        *750.2 GB   disk0

1:                        EFI                         209.7 MB   disk0s1

2:                  Apple_HFS Macintosh HD            499.2 GB   disk0s2

3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

Mit der GPT bin ich gar nicht zufrieden:

Administrators-MacBook-Pro:Volumes root# gpt show disk0

start        size  index  contents

0           1         PMBR

1           1         Pri GPT header

2          32         Pri GPT table

34           6

40      409600      1  GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640   975093952      2  GPT part – 48465300-0000-11AA-AA11-00306543ECAC

975503592     1269536      3  GPT part – 426F6F74-0000-11AA-AA11-00306543ECAC

976773128   488376007

1465149135          32         Sec GPT table

1465149167           1         Sec GPT header

Administrators-MacBook-Pro:Volumes root#

…in der Tat verweigert dieses Stepp das Vergrößern der OS X Partition.

Administrators-MacBook-Pro:Volumes root# diskutil resizeVolume disk0s2 limits

For device disk0s2 Macintosh HD:

Current size:  499.2 GB (499248103424 Bytes)

Minimum size:  177.7 GB (177742315520 Bytes)

Maximum size:  499.2 GB (499248103424 Bytes)

Daher sichere ich die Recovery Partition in ein Image:

Administrators-MacBook-Pro:Volumes root# dd if=/dev/disk0s3 of=/Volumes/My\ Book\ 1/Backup_MacintoshHD_Lion_750GB/BackupRecovery.dd bs=40000000

und schau mir die GPT-Partitionierung an:

Administrators-MacBook-Pro:Volumes root# gpt show disk0

gpt show: unable to open device ‚disk0‘: Resource busy

Argh. Die Boot-Partition wird ständig automatisch gemountet. Als kurzzeitigen Workaround rufe ich direkt vor meinem Kommando

diskutil unmount disk0s2

Volume Macintosh HD on disk0s2 unmounted

auf. Danach sofort:

Administrators-MacBook-Pro:Volumes root# gpt remove -b 975503592 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0

disk0s3 removed

Administrators-MacBook-Pro:~ root# gpt show disk0       start        size  index  contents

0           1         PMBR

1           1         Pri GPT header

2          32         Pri GPT table

34           6

40      409600      1  GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640   974609368      2  GPT part – 48465300-0000-11AA-AA11-00306543ECAC

975019008   490130160

Hä – was ist das? Meine Festplatte ist 750GB groß, aber resizen möchte diskutil nur bis 499GB? WTF?

Administrators-MacBook-Pro:~ root# diskutil resizeVolume disk0s2 limitsFor device disk0s2 Macintosh HD:

Current size:  499.0 GB (498999996416 Bytes)

Minimum size:  177.9 GB (177907052544 Bytes)

Maximum size:  499.8 GB (499763888128 Bytes)

Na gut, da ich auf meinem Reserve-Snow Leopard gerade kein gdisk zur Verfügung habe, nicht in Linux booten mag und überhaupt faul bin, löschen wir alles bzgl. Partitionen, natürlich merken wir uns vorher die Lage der Partitionen und der End-LBA:

Administrators-MacBook-Pro:~ root# dd if=/dev/zero of=/dev/disk0 bs=512 seek=1465149135

dd: /dev/disk0: end of device

34+0 records in

33+0 records out

16896 bytes transferred in 0.041953 secs (402738 bytes/sec)

Administrators-MacBook-Pro:~ root# dd if=/dev/zero of=/dev/disk0 bs=512 count=3434+0 records in

34+0 records out

17408 bytes transferred in 0.052778 secs (329834 bytes/sec)

Jetzt legen wir eine neue GPT an, bauen die Partitionen wieder an die alten Positionen und fragen diskutil, wie es das findet…

Administrators-MacBook-Pro:~ root# gpt create disk0

Administrators-MacBook-Pro:~ root# gpt show disk0

start        size  index  contents

0           1         PMBR

1           1         Pri GPT header

2          32         Pri GPT table

34  1465149101

1465149135          32         Sec GPT table

1465149167           1         Sec GPT header

Administrators-MacBook-Pro:~ root# gpt add -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0

disk0s1 added

Administrators-MacBook-Pro:~ root# gpt show disk0       start        size  index  contents

0           1         PMBR

1           1         Pri GPT header

2          32         Pri GPT table

34           6

40      409600      1  GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640  1464739495

1465149135          32         Sec GPT table

1465149167           1         Sec GPT header

Administrators-MacBook-Pro:~ root# gpt add -b 409640 -s 974609368 -t 48465300-0000-11AA-AA11-00306543ECAC disk0

disk0s2 added

Administrators-MacBook-Pro:~ root# gpt show disk0

gpt show: unable to open device ‚disk0‘: Resource busy

Administrators-MacBook-Pro:~ root# diskutil unmount disk0s2

Volume Macintosh HD on disk0s2 unmounted

Administrators-MacBook-Pro:~ root# gpt show disk0

start        size  index  contents

0           1         PMBR

1           1         Pri GPT header

2          32         Pri GPT table

34           6

40      409600      1  GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640   974609368      2  GPT part – 48465300-0000-11AA-AA11-00306543ECAC

975019008   490130127

1465149135          32         Sec GPT table

1465149167           1         Sec GPT header

Administrators-MacBook-Pro:~ root# diskutil resizeVolume disk0s2 limits

For device disk0s2 Macintosh HD:

Current size:  499.0 GB (498999996416 Bytes)

Minimum size:  177.9 GB (177907060736 Bytes)

Maximum size:  749.8 GB (749812400128 Bytes)

Administrators-MacBook-Pro:~ root#

Suppi. Na dann, die OS X Partition schon mal vergrößern:

Administrators-MacBook-Pro:~ root# diskutil resizeVolume disk0s2 601G

Started partitioning on disk0s2 Macintosh HD

Verifying disk

Resizing

Finished partitioning on disk0s2 Macintosh HD

/dev/disk0

#:                       TYPE NAME                    SIZE       IDENTIFIER

0:      GUID_partition_scheme                        *750.2 GB   disk0

1:                        EFI                         209.7 MB   disk0s1

2:                  Apple_HFS Macintosh HD            601.0 GB   disk0s2

Prima. Nächster Schritt: Recovery Partition an die alte Position poppen:

Administrators-MacBook-Pro:~ root# gpt add -b 1263986904 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0

disk0s3 added

Administrators-MacBook-Pro:~ root# gpt show disk0

start        size  index  contents

0           1         PMBR

1           1         Pri GPT header

2          32         Pri GPT table

34           6

40      409600      1  GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640  1173828120      2  GPT part – 48465300-0000-11AA-AA11-00306543ECAC

1174237760    89749144

1263986904     1269536      3  GPT part – 426F6F74-0000-11AA-AA11-00306543ECAC

1265256440   199892695

1465149135          32         Sec GPT table

1465149167           1         Sec GPT header

Irks, da ist ja noch Platz… Vergrößern wir OS X nochmals…

Administrators-MacBook-Pro:~ root# diskutil resizeVolume disk0s2 limits

For device disk0s2 Macintosh HD:

Current size:  601.0 GB (600999997440 Bytes)

Minimum size:  177.9 GB (177906176000 Bytes)

Maximum size:  646.8 GB (646817341440 Bytes)

Administrators-MacBook-Pro:~ root# diskutil resizeVolume disk0s2 646817341440B

Started partitioning on disk0s2 Macintosh HD

Verifying disk

Resizing

Finished partitioning on disk0s2 Macintosh HD

/dev/disk0

#:                       TYPE NAME                    SIZE       IDENTIFIER

0:      GUID_partition_scheme                        *750.2 GB   disk0

1:                        EFI                         209.7 MB   disk0s1

2:                  Apple_HFS Macintosh HD            646.8 GB   disk0s2

Jetzt wurde disk0s3 gelöscht. Argh.

Administrators-MacBook-Pro:~ root# gpt show disk0

start        size  index  contents

0           1         PMBR

1           1         Pri GPT header

2          32         Pri GPT table

34           6

40      409600      1  GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640  1263315120      2  GPT part – 48465300-0000-11AA-AA11-00306543ECAC

1263724760   201424375

1465149135          32         Sec GPT table

1465149167           1         Sec GPT header

Also nochmal, dann kann ich auch gleich direkt hinter OS X mit der Recovery starten:

Administrators-MacBook-Pro:~ root# gpt add -b 1263724760 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0

disk0s3 added

Administrators-MacBook-Pro:~ root# gpt show disk0

start        size  index  contents

0           1         PMBR

1           1         Pri GPT header

2          32         Pri GPT table

34           6

40      409600      1  GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640  1263315120      2  GPT part – 48465300-0000-11AA-AA11-00306543ECAC

1263724760     1269536      3  GPT part – 426F6F74-0000-11AA-AA11-00306543ECAC

1264994296   200154839

1465149135          32         Sec GPT table

1465149167           1         Sec GPT header

Bingo. Fehlt noch die Bootcamp-Partition, von der ich unglücklicherweise nur noch weiß, daß sie 102.344.163.328 Bytes groß war:

Administrators-MacBook-Pro:~ root# gpt add -b 1264994296 -s 199890944 -t EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 disk0

disk0s4 added

Administrators-MacBook-Pro:~ root# gpt show disk0

start        size  index  contents

0           1         PMBR

1           1         Pri GPT header

2          32         Pri GPT table

34           6

40      409600      1  GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640  1263315120      2  GPT part – 48465300-0000-11AA-AA11-00306543ECAC

1263724760     1269536      3  GPT part – 426F6F74-0000-11AA-AA11-00306543ECAC

1264994296   199890944      4  GPT part – EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

1464885240      263895

1465149135          32         Sec GPT table

1465149167           1         Sec GPT header

Machen wir mal ein Backup vom Anfang der Festplatte, um diese ganzen Änderungen nicht erneut machen zu müssen:

Administrators-MacBook-Pro:~ root# dd if=/dev/disk0 of=./MBR_GPT_status_after_modifications.bin bs=512 count=34

34+0 records in

34+0 records out

17408 bytes transferred in 0.317930 secs (54754 bytes/sec)

Schauen wir uns noch kurz den PMBR an:

Administrators-MacBook-Pro:~ root# fdisk /dev/disk0

Disk: /dev/disk0geometry: 91201/255/63 [1465149168 sectors]

Signature: 0xAA55

Starting       Ending

#: id  cyl  hd sec -  cyl  hd sec [     start –       size]

————————————————————————

1: EE 1023 254  63 – 1023 254  63 [         1 – 1465149167] <Unknown ID>

2: 00    0   0   0 -    0   0   0 [         0 -          0] unused

3: 00    0   0   0 -    0   0   0 [         0 -          0] unused

4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Wie man sieht gibt es eine Partition mit Typ EE, das sicherheitshalber die gesamte Platte umspannt, falls man ein Tool auf die Partitionierung losläßt, was nur das MBR-Partitionierungsschema unterstützt. Wir werden diesen MBR später modifizieren müssen. Und nein, man benutzt nicht fdisk -i /dev/disk0.

Jetzt sichern wir die Recovery-Partition zurück:

Administrators-MacBook-Pro:~ root# dd if=/Volumes/My\ Book\ 1/Backup_MacintoshHD_Lion_750GB/BackupRecovery.dd of=/dev/disk0s3 bs=40000000

16+1 records in

16+1 records out

650002432 bytes transferred in 26.750987 secs (24298260 bytes/sec)

Jetzt restoren wir das Image der Bootcamp-Partition. Ich habe clonezilla (und darin partclone) benutzt. Kleines Image, aber ich muss leider wieder in clonezilla booten, um es zu restaurieren.

Disk: /dev/rdisk0geometry: 91201/255/63 [1465149168 sectors]

Offset: 0Signature: 0xAA55

Starting       Ending

#: id  cyl  hd sec -  cyl  hd sec [     start –       size]

————————————————————————

1: EE 1023 254  63 – 1023 254  63 [         1 – 1465149167] <Unknown ID>

2: 00    0   0   0 -    0   0   0 [         0 -          0] unused

3: 00    0   0   0 -    0   0   0 [         0 -          0] unused

4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

fdisk: 1> edit

Invalid argument: edit <partition number>

fdisk: 1> edit 1

Starting       Ending

#: id  cyl  hd sec -  cyl  hd sec [     start –       size]

————————————————————————

1: EE 1023 254  63 – 1023 254  63 [         1 – 1465149167] <Unknown ID>

Partition id (‚0‘ to disable)  [0 – FF]: [EE] (? for help) EE

Do you wish to edit in CHS mode? [n] n

Partition offset [0 – 1465149168]: [63] 1

Partition size [1 – 1465149167]: [1465149167] 409639

fdisk:*1> edit 2

Starting       Ending

#: id  cyl  hd sec -  cyl  hd sec [     start –       size]

————————————————————————

2: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Partition id (‚0‘ to disable)  [0 – FF]: [0] (? for help) AF

Do you wish to edit in CHS mode? [n] n

Partition offset [0 – 1465149168]: [409640] 409640

Partition size [1 – 1464739528]: [1464739528] 1263315120

fdisk:*1> edit 3

Starting       Ending

#: id  cyl  hd sec -  cyl  hd sec [     start –       size]

————————————————————————

3: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Partition id (‚0‘ to disable)  [0 – FF]: [0] (? for help) AB

Do you wish to edit in CHS mode? [n] n

Partition offset [0 – 1465149168]: [1263724760] 1263724760

Partition size [1 – 201424408]: [201424408] 1269536

fdisk:*1> edit 4

Starting       Ending

#: id  cyl  hd sec -  cyl  hd sec [     start –       size]

————————————————————————

4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Partition id (‚0‘ to disable)  [0 – FF]: [0] (? for help) 07

Do you wish to edit in CHS mode? [n] n

Partition offset [0 – 1465149168]: [1264994296] 1264994296

Partition size [1 – 200154872]: [200154872] 199890944

fdisk:*1> print

Disk: /dev/rdisk0geometry: 91201/255/63 [1465149168 sectors]

Offset: 0Signature: 0xAA55

Starting       Ending

#: id  cyl  hd sec -  cyl  hd sec [     start –       size]

————————————————————————

1: EE    0   0   2 – 1023 254  63 [         1 –     409639] <Unknown ID>

2: AF 1023 254  63 – 1023 254  63 [    409640 – 1263315120] HFS+

3: AB 1023 254  63 – 1023 254  63 [1263724760 -    1269536] Darwin Boot

4: 07 1023 254  63 – 1023 254  63 [1264994296 -  199890944] HPFS/QNX/AUX

fdisk:*1> write

Device could not be accessed exclusively.

A reboot will be needed for changes to take effect. OK? [n] y

Writing MBR at offset 0.

fdisk: 1> quit

Administrators-MacBook-Pro:~ root#

Natürlich meinen die Damen und Herren das mit dem Reboot absolut ernst!
Nichtsdestoweniger – mein Vista im Bootcamp mochte dennoch nicht booten.

Der Witz an Windows ist ja meist, dass so tolle alte Dinge wie z.B. CHS aus Kompatibilitäts- (und Faulheits-) Gründen trotz des Aufkommens von LBA Ende des letzten Jahrtausends an lustigen Stellen versteckt ist.
Ntloader (das ist der Bootloader von Windows eNTen) hinterlegt die Position der Bootdatei im NTFS (http://bootmaster.filerecovery.biz/appnote3.html) – mit der Folge, dass ein Verschieben der Partition
oder die Änderung der Plattengeometrie reproduzierbar zum Nicht-Mehr-Booten-Können führt, obwohl mit dem Dateisystem eigentlich alles in Ordnung ist.

Eigentlich hätte mir ntfsresize helfen sollen, clonezilla hat das auch automagisch ausgeführt, aber aus irgendeinem Grund meinte die Version, nichts tun zu müssen.
Mift. Naja, mir wurde die ganze Thematik dann eh zu blöd, ich habe irgendwo noch eine Kopie meiner alten Partitionierung aus einem Archiv gekramt und die ur-
sprünglichen Start-LBA der NTFS-Partition gefunden. Daher habe ich obiges alles noch mal gemacht, war sozusagen nur ne Fingerübung. Wer mir gefolgt ist,
hat auch selbst ordentlich trainiert – daher: Herzlichen Glückwunsch!

Leave a Reply

You must be logged in to post a comment.