Re: rebuilding my partition map
On 23 Aug, this message from Grant Hollingworth echoed through cyberspace:
> I did a stupid thing...
Say what :-)
> Not knowing how to use hpmount (of hfsplus), I ran 'hpmount /dev/hda'. A
> while ago I had put myself in the disk group (can't remember why), so I
> had write permission to /dev/hda.
>
> /sbin/mac-fdisk -l /dev/hda now returns nothing.
Yeah, partition map is bust. You need to recreate it by hand.
> My system is still running, but I have the feeling that rebooting would
> be unpleasant.
It won't reboot.
> How can I reconstruct the partition map?
Recreate it with mac-fdisk. But first, as suggested in another mail, try
to back up as much as possible to some other media! dd is you friend.
> df and /proc/partitions have
> some information:
That is good. However, remember that the blocks reported are 1k-blocks,
whereas the partition map works with 512k-blocks!
> spooky$ df
> Filesystem 1K-blocks Used Available Use% Mounted on
> /dev/hda11 1032088 144300 835360 15% /
> /dev/hda13 2064208 1593620 365732 82% /home
> /dev/hda14 495844 381031 89213 82% /var
> /dev/hda15 2064208 1814668 144684 93% /photo
> /dev/hda16 2064208 1739884 219468 89% /usr
>
> spooky$ cat /proc/partitions
>
> major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
>
> 3 0 19535040 hda 182128 300566 2458956 3295240 155294 861994 3732712 28351960 -44 41433290 -1322175690
> 3 1 31 hda1 0 0 0 0 0 0 0 0 0 0 0
> 3 2 27 hda2 0 0 0 0 0 0 0 0 0 0 0
> 3 3 37 hda3 0 0 0 0 0 0 0 0 0 0 0
> 3 4 27 hda4 0 0 0 0 0 0 0 0 0 0 0
> 3 5 37 hda5 0 0 0 0 0 0 0 0 0 0 0
> 3 6 100 hda6 0 0 0 0 0 0 0 0 0 0 0
> 3 7 256 hda7 0 0 0 0 0 0 0 0 0 0 0
> 3 8 256 hda8 0 0 0 0 0 0 0 0 0 0 0
> 3 9 9767129 hda9 0 0 0 0 0 0 0 0 0 0 0
> 3 10 800 hda10 0 0 0 0 0 0 0 0 0 0 0
> 3 11 1048576 hda11 10109 9980 160706 189570 18445 35267 431448 3512910 0 980160 3706220
> 3 12 131072 hda12 11471 28094 316520 347430 7830 36837 363328 1055590 0 279710 1407130
> 3 13 2097152 hda13 13894 22890 169914 177570 15475 52787 438734 2510310 0 580990 2691650
> 3 14 512000 hda14 63488 131747 390484 1235170 74392 625891 1401758 11905470 0 1543830 13163750
> 3 15 2097152 hda15 3204 24259 174146 106320 815 7852 23580 155470 0 87230 269320
> 3 16 2097152 hda16 79851 82695 1245162 1237600 38336 103360 1073862 9212200 0 1753670 10464410
> 3 17 1783235 hda17 0 0 0 0 0 0 0 0 0 0 0
>
>
> hda12 is swap. hda17 is free space. hda10 is my boot partition. hda9 is
> an hfs plus partition. The first eight partitions are the weird Mac OS
> ones.
>
> With the info I have now, it seems like I can (maybe) rescue my Linux setup. I
> would like to repair the Mac OS partitions, too, but I don't have
> anything important on them.
>
> Any ideas?
Based on the above info and my own partition map, here is what you
should enter in mac-fdisk:
# type name length base ( size ) system
/dev/hda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map
/dev/hda2 Apple_Driver43 Macintosh 54 @ 64 ( 27.0k) Driver 4.3
/dev/hda3 Apple_Driver43 Macintosh 74 @ 118 ( 37.0k) Driver 4.3
/dev/hda4 Apple_Driver_ATA Macintosh 54 @ 192 ( 27.0k) Unknown
/dev/hda5 Apple_Driver_ATA Macintosh 74 @ 246 ( 37.0k) Unknown
/dev/hda6 Apple_FWDriver Macintosh 200 @ 320 (100.0k) Unknown
/dev/hda7 Apple_Driver_IOKit Macintosh 512 @ 520 (256.0k) Unknown
/dev/hda8 Apple_Patches Patch Partition 512 @ 1032 (256.0k) Unknown
/dev/hda9 Apple_HFS <whatever> 19534258 @ 1544 ( 9.3G) HFS
/dev/hda10 Apple_Bootstrap Bootstrap 1600 @ 19535802 (800.0k) NewWorld bootblock
/dev/hda11 Apple_UNIX_SVR2 Root 2097152 @ 19537402 ( 1.0G) Linux native
/dev/hda12 Apple_UNIX_SVR2 Swap 262144 @ 21634554 (128.0M) Linux swap
/dev/hda13 Apple_UNIX_SVR2 Home 4194304 @ 21896698 ( 2.0G) Linux native
/dev/hda14 Apple_UNIX_SVR2 Var 1024000 @ 26091002 (500.0M) Linux native
/dev/hda15 Apple_UNIX_SVR2 Photo 4194304 @ 27115002 ( 2.0G) Linux native
/dev/hda16 Apple_UNIX_SVR2 Usr 4194304 @ 31309306 ( 2.0G) Linux native
/dev/hda17 Apple_Free Extra 3566470 @ 35503610 ( 1.7G) Free space
First, initialize a new partition map. Then, check the partition map
size created matches the above output. If not, there is a command in
mac-fdisk to change that.
Then, create the partitions _also_specifying_the_type. base and length
above are the values you need. As you go along, check that what you get
is correct. The partition type is the string found above (no hex values
here...). hda17 doesn't need to be created; it will be there by default.
Then, go ahead and write out the partition map. This may lock up your
system, depending on the sate of the disk....
Also, chances are the hfsplus tools overwrote random parts of the disk,
so afterwards you should at least update the drivers from a MacOS rescue
CD (that should recreate the contents of the driver partitions), and do
filesystem checks (Disk First Aid ? from a MacOS rescue CD for the
HFS/HFS+ partitions; fsck in Linux)
Good luck...
Michel
PS By the way, should you be forced to reinstall, create the Bootstrap
partition _before_ any other user partitions!
PPS Don't hold me responsible if I screwed up the calculations of size &
offset in the map above...
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art.
23, Rue Paul Henkes | Ask Questions. Make Mistakes.
L-1710 Luxembourg |
email mlan@cpu.lu |
http://www.cpu.lu/~mlan | Learn Always. "
Reply to: