1

Topic: To back HFS+ flag

Hello guys,

I have a 80gb disk with hfs+ partition (only partition in disk). I have mounted in Linux (ubuntu 8 live cd), no problem. Opening Gparted, I see some informations and more, about the disk (with hfs+). Well, my mistake was... with right clicking, I choose "Manage Flags" and so, unmark "boot" option and OK. After this, I was open this same window and so mark the "boot" option.

Well, After this BIG and MY STUPID mistake... my Disk Utility in Leopard DVD do not read my partition as hfs+ and yes, like FS: Linux Native... and when I open this partition with Linux Ubuntu (live cd), GParted display this partition as hfs+. When I mount this partition in Linux, my files, directories and more... are ALL good.

Using FDISK in Linux, I have:
______________________________________________
Disco /dev/sda: 80.0 GB, 80060424192 bytes
255 heads, 63 sectors/track, 9733 cylinders
Units = cilindros of 16065 * 512 = 8225280 bytes
Disk identifier: 0x063a6ced

Dispositivo Boot Início Fim Blocos Id Sistema
/dev/sda1   *           1        9733    78180291   83  Linux
______________________________________________

So, how to back to hfs+ flag, without destroy my data? Sorry, if my question is bad and/or stupid. I am really worry.
Thanks in advanced. Sorry for my bad english also.

--
Eduardo

2

Re: To back HFS+ flag

Which is the GParted version used? 8.04 contains 0.3.5 version, if I remember well. I don't know about the newer 8.10 (alpha or beta? ).

*** It is highly recommended to backup any important files before doing resize/move operations. ***

3

Re: To back HFS+ flag

Ouch! Sorry... Gparted version is 0.3.5, Ubuntu 8.04LTS.

4 (edited by gedakc 2008-08-25 18:43:27)

Re: To back HFS+ flag

Following is my theory on this problem.  Please note that my knowledge of MacOS X is limited so I may be wrong.

SOURCE OF PROBLEM:
When changing the boot flag, data is changed in the partition table only.  The boot flag change does not modify the HFS+ file system.  Hence all of your data should still be intact in the HFS+ file system (as you discovered).

I think MacOS X uses the GPT partition table, which can also have a MBR partition table synchronized within it.  In this case the combination of the two partition tables is called EFI.  I suspect that when the boot flag was changed, it was modified only on the MBR partition table and now the GPT and MBR partition tables are out of sync.  If you are curious about any of the above three letter acronyms, simply check wikipedia for definitions.  :-)

STEPS TO A POSSIBLE FIX:
1)  Backup all of your important data.  This is always a wise choice when altering partition tables or file systems.
2)  Read the following article regarding a person who had a similar, though different, problem with partition tables being out of sync.
     http://forums.macosxhints.com/showthread.php?t=72972
3)  Try to re-sync the partition tables.  From the above article, I believe the command to re-sync the partition tables is "gptsync /dev/sda" (assuming your hard drive device is /dev/sda).
     I believe the gptsync command is part of the rEFIt package.
     http://refit.sourceforge.net/
4)  Hopefully MacOS X will now boot for you.

5

Re: To back HFS+ flag

class413 and gedakc,
Thank you. Your help and tips are really good. I will to try these steps and in few some days I will be back here to report a feedback. Thanks for your patience and good teaching methodology smile

Cheers,

--
Eduardo

6

Re: To back HFS+ flag

Guys,
Running gptsync:

____________________________________
Current GPT partition table:
No GPT partition table present!

Current MBR partition table:
# A    Start LBA      End LBA  Type
1 *           63    156360644  83  Linux

Status: No GPT partition table, no need to sync.
____________________________________

Well, I couldn't make backup, because I didn't have permission to open some protected directories via Ubuntu (called 501 permission, I think). I don't know what to do now. Thanks for your help.

--
Eduardo

7 (edited by gedakc 2008-09-02 18:08:34)

Re: To back HFS+ flag

All hope is not lost yet :-)  There is always the possibility of fixing the problem by directly editing the disk, or by asking questions in Mac OSX forums.

Is yours an Intel based Mac, or a Power PC based Mac?

From your above post, it appears that you have attempted to back up all the data you can.  Also it appears that we are dealing with an Master Boot Record (MBR) partition table, and not a GPT partition table.

The details of how the MBR can be found at:
http://en.wikipedia.org/wiki/Master_boot_record

From this link, the most likely 16 bytes to be causing the problem are from 0x01BE to 0x01CD.
The boot flag is stored at 0x01BE.
The partition type is stored at 0x1C2.

Would you be able to provide the output of a hex dump of the first 512 bytes?
To do this you could boot from the ubuntu livecd and try (as root):
     hexdump -C -n 512 /dev/sda

It would also be useful to have a hexdump of the first 512 bytes from a working Mac to compare with.

8 (edited by ambientalien 2008-09-02 18:47:34)

Re: To back HFS+ flag

Dear Gedakc,

root@ubuntu:~# hexdump -C -n 512 /dev/sda

00000000  eb 48 90 d0 bc 00 7c fb  50 07 50 1f fc be 1b 7c  |.H....|.P.P....||
00000010  bf 1b 06 50 57 b9 e5 01  f3 a4 cb bd be 07 b1 04  |...PW...........|
00000020  38 6e 00 7c 09 75 13 83  c5 10 e2 f4 cd 18 8b f5  |8n.|.u..........|
00000030  83 c6 10 49 74 19 38 2c  74 f6 a0 b5 07 b4 03 02  |...It.8,t.......|
00000040  80 00 00 20 01 00 00 00  00 02 fa 90 90 f6 c2 80  |... ............|
00000050  75 02 b2 80 ea 59 7c 00  00 31 c0 8e d8 8e d0 bc  |u....Y|..1......|
00000060  00 20 fb a0 40 7c 3c ff  74 02 88 c2 52 be 7f 7d  |. ..@|<.t...R..}|
00000070  e8 34 01 f6 c2 80 74 54  b4 41 bb aa 55 cd 13 5a  |.4....tT.A..U..Z|
00000080  52 72 49 81 fb 55 aa 75  43 a0 41 7c 84 c0 75 05  |RrI..U.uC.A|..u.|
00000090  83 e1 01 74 37 66 8b 4c  10 be 05 7c c6 44 ff 01  |...t7f.L...|.D..|
000000a0  66 8b 1e 44 7c c7 04 10  00 c7 44 02 01 00 66 89  |f..D|.....D...f.|
000000b0  5c 08 c7 44 06 00 70 66  31 c0 89 44 04 66 89 44  |\..D..pf1..D.f.D|
000000c0  0c b4 42 cd 13 72 05 bb  00 70 eb 7d b4 08 cd 13  |..B..r...p.}....|
000000d0  73 0a f6 c2 80 0f 84 ea  00 e9 8d 00 be 05 7c c6  |s.............|.|
000000e0  44 ff 00 66 31 c0 88 f0  40 66 89 44 04 31 d2 88  |D..f1...@f.D.1..|
000000f0  ca c1 e2 02 88 e8 88 f4  40 89 44 08 31 c0 88 d0  |........@.D.1...|
00000100  c0 e8 02 66 89 04 66 a1  44 7c 66 31 d2 66 f7 34  |...f..f.D|f1.f.4|
00000110  88 54 0a 66 31 d2 66 f7  74 04 88 54 0b 89 44 0c  |.T.f1.f.t..T..D.|
00000120  3b 44 08 7d 3c 8a 54 0d  c0 e2 06 8a 4c 0a fe c1  |;D.}<.T.....L...|
00000130  08 d1 8a 6c 0c 5a 8a 74  0b bb 00 70 8e c3 31 db  |...l.Z.t...p..1.|
00000140  b8 01 02 cd 13 72 2a 8c  c3 8e 06 48 7c 60 1e b9  |.....r*....H|`..|
00000150  00 01 8e db 31 f6 31 ff  fc f3 a5 1f 61 ff 26 42  |....1.1.....a.&B|
00000160  7c be 85 7d e8 40 00 eb  0e be 8a 7d e8 38 00 eb  ||..}.@.....}.8..|
00000170  06 be 94 7d e8 30 00 be  99 7d e8 2a 00 eb fe 47  |...}.0...}.*...G|
00000180  52 55 42 20 00 47 65 6f  6d 00 48 61 72 64 20 44  |RUB .Geom.Hard D|
00000190  69 73 6b 00 52 65 61 64  00 20 45 72 72 6f 72 00  |isk.Read. Error.|
000001a0  bb 01 00 b4 0e cd 10 ac  3c 00 75 f4 c3 00 00 00  |........<.u.....|
000001b0  00 00 00 00 00 00 00 00  ed 6c 3a 06 00 00 80 01  |.........l:.....|
000001c0  01 00 83 fe ff ff 3f 00  00 00 86 df 51 09 00 00  |......?.....Q...|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|

The hexdump return it.
I'm using Intel Mac with MBR. Not GPT.

Thanks again.

--
Eduardo

9 (edited by gedakc 2008-09-02 19:10:29)

Re: To back HFS+ flag

Please remember that my knowledge of Mac OSX is extremely limited.

Do you use the GRand Unified Bootloader (GRUB) to boot?

If not, then this thread may have the clue to how to restore your leopard boot loader:
http://www.insanelymac.com/lofiversion/ … 00699.html

From the above thread I think the relevant commands to restore the leopard boot loader are:

1. Boot off OSX dvd disc in single user mode (press F8 and type -s)
2. At single user prompt:
    fdisk -e /dev/rdisk0
    flag 1
    update
    write
    quit
4. reboot

At this point OSX should boot up.


If you are using GRUB, then we are probably looking at a different problem.

10 (edited by ambientalien 2008-09-02 22:02:04)

Re: To back HFS+ flag

Dear Gedakc,

Using the step 2 and fdisk -u /dev/rdisk0 and YES to confirm, I was restored MBR and restored Leo Bootloader. But, unfortunately, my HD is not recognized inside OSX - and do not boot, of course - [using other HD] as HFS+ partition and yes, like Linux partition. Inside Linux, Gparted read this partition like HFS+.

About the GRUB, I do not know what is this (why the GRUB in the disk?). Really. Well, we back to the initial point... but I could to learn many things with you. Thanks till now.

--
Eduardo

11 (edited by gedakc 2008-09-02 22:38:35)

Re: To back HFS+ flag

Would you be able to provide a hexdump of the first 512 bytes of the drive now that the Leopard bootloader is installed?

We may be able to figure something out by looking at this code.

As an add-on to the previous steps, there may be a few more things to do to get Leopard to boot.
Have a look at the following link (specifically post#3):
http://forum.insanelymac.com/index.php?showtopic=68189

12 (edited by ambientalien 2008-09-03 09:33:44)

Re: To back HFS+ flag

Dear Gedakc,

Following the hexdump output below:

00000000  fa 31 c0 8e d0 bc f0 ff  fb 8e c0 8e d8 be 00 7c  |?1?.м???.?.ؾ.||
00000010  bf 00 e0 fc b9 00 01 f2  a5 ea 1e e0 00 00 66 31  |?.???..??.?..f1|
00000020  c0 66 a3 00 e4 66 a3 04  e4 a2 08 e4 b4 41 bb aa  |?f?.?f?.?.?A??|
00000030  55 cd 13 72 0e 81 fb 55  aa 75 08 f6 c1 01 0f 95  |U?.r..?U?u.??...|
00000040  06 08 e4 b0 01 31 db 8e  c3 bb 00 10 89 de c7 04  |..?.1?.û...??.|
00000050  00 00 c7 44 02 01 00 66  c7 44 08 00 00 00 00 e8  |..?D...f?D.....?|
00000060  b2 00 72 06 bf be 11 e8  10 00 fe c2 f6 c2 04 74  |?.r.??.?..????.t|
00000070  ad be 89 e1 e8 f8 00 f4  eb fd 51 56 81 7d 40 55  |??.???.???QV.}@U|
00000080  aa 0f 85 8c 00 89 fe b9  04 00 80 7c 04 00 74 2e  |?.....??...|..t.|
00000090  80 3c 80 75 29 66 a1 04  e4 66 a3 00 e4 b0 01 bb  |.<.u)f?.?f?.?.?|
000000a0  00 00 8e c3 bb 00 7c e8  6a 00 72 c5 66 8b 44 08  |...û.|?j.r?f.D.|
000000b0  66 03 06 04 e4 66 89 44  08 ea 00 7c 00 00 81 c6  |f...?f.D.?.|...?|
000000c0  10 00 e2 c6 89 fe b9 04  00 8a 44 04 3c 05 74 11  |..??.??...D.<.t.|
000000d0  3c 0f 74 0d 3c 85 74 09  81 c6 10 00 e2 eb e9 30  |<.t.<.t..?..???0|
000000e0  00 66 8b 6c 08 b0 01 31  db 8e c3 bb 00 12 e8 23  |.f.l.?.1?.û..?#|
000000f0  00 72 e5 66 03 2e 00 e4  66 89 2e 04 e4 66 a1 00  |.r?f...?f...?f?.|
00000100  e4 66 09 c0 75 05 66 89  2e 00 e4 bf be 13 e8 69  |?f.?u.f...俾.?i|
00000110  ff 5e 59 c3 51 f6 06 08  e4 01 74 0a b9 05 00 e8  |?^Y?Q?..?.t.?..?|
00000120  24 00 73 0c e2 f9 b9 05  00 e8 06 00 73 02 e2 f9  |$.s.???..?..s.??|
00000130  59 c3 60 8a 74 01 8b 4c  02 b4 02 cd 13 73 05 31  |Y?`.t..L.?.?.s.1|
00000140  c0 cd 13 f9 61 c3 60 89  e5 1e 1e 66 8b 0e 00 e4  |??.?a?`.?..f...?|
00000150  66 03 4c 08 66 51 06 53  30 e4 50 68 10 00 89 e6  |f.L.fQ.S0?Ph...?|
00000160  b4 42 cd 13 73 05 31 c0  cd 13 f9 89 ec 61 c3 bb  |?B?.s.1??.?.?aû|
00000170  01 00 fc ac 3c 00 74 06  b4 0e cd 10 eb f5 c3 60  |..??<.t.?.?.???`|
00000180  bb 01 00 b4 0e cd 10 61  c3 0a 0d 62 30 20 65 72  |?..?.?.a?..b0 er|
00000190  72 6f 72 00 00 00 00 00  00 00 00 00 00 00 00 00  |ror.............|
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 80 01  |................|
000001c0  01 00 83 fe ff ff 3f 00  00 00 86 df 51 09 00 00  |...????....?Q...|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

I'll try this option from InsanelyMac. Thanks again.

--
Eduardo

13

Re: To back HFS+ flag

From the hexdump, it appears that the Leopard MBR contains very different load code from GRUB.

Did you have any success with the extra steps from InsanelyMac?

14 (edited by ambientalien 2008-09-04 05:22:11)

Re: To back HFS+ flag

Dear Gedakc,
Following the extra steps from InsanelyMac: (assuming 0 the only disk, ok?)

sudo fdisk -e /dev/rdisk0
update
flag 1
write
yes
quit
reboot

The next step, via DVD [F8 option, -s command to bash only]:

dd if=/usr/standalone/i386/boot1h of=/dev/rdisk0s1 bs=512 count=1
cd /usr/sbin
startupfiletool -v /dev/rdisk0s1 /usr/standalone/i386/boot
bless -device /dev/rdisk0s1 -setBoot -verbose
reboot

Well, no success until now. The Leopard recognize the partition like Linux partition and Ubuntu like HFS+ partition.

--
Eduardo

15

Re: To back HFS+ flag

I apologize, as I am a bit confused as to whether your system works now or not.

Does your computer properly boot Leopard now?

16

Re: To back HFS+ flag

Dear Gedakc,

Not yet. =/

--
Eduardo

17 (edited by gedakc 2008-09-05 19:45:26)

Re: To back HFS+ flag

From the InsanelyMac article post #6, it mentions that the partition needs to be marked as bootable.  By looking that the hexdump you provided in comment #12, it appears that the partition is bootable (e.g., the value at 0x01BE is 80 hex).

The next thing that appears to be incorrect is the partition id.  From reading the article listed below, it appears that the partition id for Mac OS X should be AF.  From the above hexdump, it appears that the partition id is 83 (look at the value at 0x01C2).

(Note:  Search for the section titled "Important note for re-occuring HFS+ problems:"
     http://forum.insanelymac.com/index.php? … amp;hl=hfs

Following are the list of steps from the article that I believe need to be executed:
In your case, I understand you have OS X on the first partition so use "flag 1" and "setpid 1" instead.

Text from Article wrote:

Firstly, you'll have to boot off your OS X Installation Disc in single user mode. This can be done by pressing F8 at the disc's Darwin Prompt and typing -s.
At the single user prompt, type these commands exactly:

fdisk -e /dev/rdisk0
Specifies the disc that you have Vista and OS X installed to
The specified location rdisk0 may of course be different if Vista or OS X was installed on a different drive, e.g. rdisk1, rdisk2

flag 2
Marks OS X as the active partition (or if you installed OS X 1st and Vista 2nd, change the flag to 1)

setpid 2
Change the partition identifier of the given partition table entry (the number corresponds with the OS X partition)

AF
Sets HFS+ as the correct PID so that you can boot Mac OS X

quit
This will quit fdisk and take you back to the normal single user prompt

Now, when you restart you should have a fully bootable Mac OS X partition with Darwin working perfectly.

Hopefully that will have you back up and working again :-)