Jump to content

How to fix a bad or broken EFI partition to be working with UEFI booters


leon321
 Share

18 posts in this topic

Recommended Posts

This topic concerns how to fix the ESP (EFI System Partition) in the cases it get corrupted or with the wrong file system.

 

 

Hi
I am running a multi Mac Osx Os on a GA-X58A-UD3R.
6 months ago, I changed Chameleon boot loader to Chimera, and all worked fine.
Then, today, trying to fix an other HDD on this Hack, I killed something around EFI clover partition.
I presume this, because I can boot from Clover USB and select any OS that I can launch and run successfully.

Now I tried to reformat EFI partition,
newfs_msdos -v EFI /dev/disk0s1
Then reload it from a CCC archive
and reboot
I also tried to reinstall Clover using Clover_v2.3k_r3489.pkg
I still have this message at boot (from HDD)
Non System disk
Press any key to reboot
 

I found in clover wiki how to install ( re install ?) manually Clover

so I did :

bash-3.2# fdisk440 -f boot0af -u -y /dev/rdisk0
bash-3.2# sudo dd if=boot1h2 of=/dev/rdisk0s1
2+0 records in
2+0 records out
1024 bytes transferred in 0.000584 secs (1753764 bytes/sec)
bash-3.2# fdisk440 -e /dev/rdisk0
Enter 'help' for information
fdisk: 1> f 1
Partition 1 marked active.
fdisk:*1> w
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> q

 

EFI partition is loaded from a backup,

so content must be OK.

 

If I reboot I still get

Non System disk

Press any key to reboot

I guess this may be linked with 4096 bytes sectors …?

attached are darwin Dumper logs
Please help
 
Leon

DarwinDumper_log.txt.zip

DarwinDump.htm.zip

Link to comment
Share on other sites

Hi

I am running a multi Mac Osx Os on a GA-X58A-UD3R.

6 months ago, I changed Chameleon boot loader to Chimera, and all worked fine.

Then, today, trying to fix an other HDD on this Hack, I killed something around EFI clover partition.

I presume this, because I can boot from Clover USB and select any OS that I can launch and run successfully.

 

Now I tried to reformat EFI partition,

newfs_msdos -v EFI /dev/disk0s1

Then reload it from a CCC archive

and reboot

I also tried to reinstall Clover using Clover_v2.3k_r3489.pkg

I still have this message at boot (from HDD)

Non System disk

Press any key to reboot

 

I found in clover wiki how to install ( re install ?) manually Clover

so I did :

bash-3.2# fdisk440 -f boot0af -u -y /dev/rdisk0

bash-3.2# sudo dd if=boot1h2 of=/dev/rdisk0s1

2+0 records in

2+0 records out

1024 bytes transferred in 0.000584 secs (1753764 bytes/sec)

bash-3.2# fdisk440 -e /dev/rdisk0

Enter 'help' for information

fdisk: 1> f 1

Partition 1 marked active.

fdisk:*1> w

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> q

 

EFI partition is loaded from a backup,

so content must be OK.

 

If I reboot I still get

Non System disk

Press any key to reboot

I guess this may be linked with 4096 bytes sectors …?

 

attached are darwin Dumper logs

Please help

 

Leon

No,

1. newfs_msdos -F32  -v EFI/dev/disk0s1

There is very significant to choose F32 else for small drive F16 will be created by default resulting "No system disk".

2. # sudo dd if=boot1h2 of=/dev/rdisk0s1 

Don't do this! This is for HFS+ file system while you make msdos.

dd if=/dev/disk0s1 count=1 bs=512 of=/tmp/origbs
cp boot1f32 /tmp/newbs
dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc
dd of=/dev/disk0s1 count=1 bs=512 if=/tmp/newbs

3. Don't mark EFI as active partition!  If no active partition then EFI partition will be used.

4. No relation to block size 4096. It may influence only on DOS drivers using INT13.

Link to comment
Share on other sites

Thank you Slice

 

Clover don't agree about Fat32

see https://clover-wiki.zetam.org/FAQ#q-i-got-boot0-error-or-b1f-error

 

what I did :

I reformat EFI part using now:

# newfs_hfs -v EFI /dev/disk0s1

Initialized /dev/rdisk0s1 as a 200 MB case-insensitive HFS Plus volume

bash-3.2# mkdir /Volumes/EFI

bash-3.2# mount -t hfs /dev/disk0s1 /volumes/EFI

 

Then I did a restauration from achive using Carbon copy cloner

 

Unmount EFI

 

Apply your proposed file handling

dd if=/dev/disk0s1 count=1 bs=512 of=/tmp/origbs

cp boot1f32 /tmp/newbs

dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc

dd of=/dev/disk0s1 count=1 bs=512 if=/tmp/newbs

 

Then reboot to ubuntu and, using gparted, clear boot flag in EFI.

 

Reboot main HDD,

I don't see the boot0 and

I still get 

" Non System disk
Press any key to reboot "

 

So... may be i did something wrong ?

Or problem comes from MBR ?

 

From there I did some progress, I was booting on second HDD (Bios setup error) :-(

 

So at boot to Macos HDD I have the message:

b1f : init

b1f : error

 

 

going further,

I finally install Clover in Yosemite partition manually and it works !

Impossible to use EFI....

 

Most important is that my Hack works again.

 

Thank for your help

 

Leon

  • Like 1
Link to comment
Share on other sites

@leon321 - the ESP must be FAT32. the PC BIOS does not know how to read HFS. reformat your EFI per slice.

 

even the note in the wiki says:

Q: I got boot0:error or b1f:error

A: One of the possible reason is wrong partition File System. PBR sector boot1f32 requires namely FAT32 but not FAT16 or ExFAT. If you are not sure then it is recommended to reformat your partition with command

newfs_msdos -v EFI -F 32 /dev/rdisk0s1

Link to comment
Share on other sites

Thank you Slice

 

Clover don't agree about Fat32

see https://clover-wiki.zetam.org/FAQ#q-i-got-boot0-error-or-b1f-error

 

what I did :

I reformat EFI part using now:

# newfs_hfs -v EFI /dev/disk0s1

Initialized /dev/rdisk0s1 as a 200 MB case-insensitive HFS Plus volume

bash-3.2# mkdir /Volumes/EFI

bash-3.2# mount -t hfs /dev/disk0s1 /volumes/EFI

 

Then I did a restauration from achive using Carbon copy cloner

 

Unmount EFI

 

Apply your proposed file handling

dd if=/dev/disk0s1 count=1 bs=512 of=/tmp/origbs

cp boot1f32 /tmp/newbs

dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc

dd of=/dev/disk0s1 count=1 bs=512 if=/tmp/newbs

 

Then reboot to ubuntu and, using gparted, clear boot flag in EFI.

 

Reboot main HDD,

I don't see the boot0 and

I still get

" Non System disk

Press any key to reboot "

 

So... may be i did something wrong ?

Or problem comes from MBR ?

 

From there I did some progress, I was booting on second HDD (Bios setup error) :-(

 

So at boot to Macos HDD I have the message:

b1f : init

b1f : error

 

 

going further,

I finally install Clover in Yosemite partition manually and it works !

Impossible to use EFI....

 

Most important is that my Hack works again.

 

Thank for your help

 

Leon

Since you're "playing" with the ESP, you could check its structure against the info from the link below.

 

Tip: useful information can be found in the answer marked as best, aka the one with a green check symbol. ?

 

Proceed with caution!

 

http://apple.stackexchange.com/questions/57597/how-to-fix-broken-efi-partition
 
Best regards.
  • Like 1
Link to comment
Share on other sites

Thanks Needy for your input.

I did exactly what is described in the provided link.

http://apple.stackexchange.com/questions/57597/how-to-fix-broken-efi-partition

 

The only problem is that i can only mount this partition using

mount -t msdos /dev/disk0s1 /Volumes/EFI

EFI volume appears but.....

Clover install package don't see it

Carbon copy cloner also so I can't install Clover or restaure partition from archive......

 

I did not find

tip: useful information can be found in the answer marked as best, aka the one with a green check symbol.

 

 

Mount as HFS is denied

bash-3.2# mount_hfs /dev/disk0s1 /Volumes/EFI
mount_hfs: Invalid argument

 

Leon

Link to comment
Share on other sites

Thanks Needy for your input.

I did exactly what is described in the provided link.

http://apple.stackexchange.com/questions/57597/how-to-fix-broken-efi-partition

 

The only problem is that i can only mount this partition using

mount -t msdos /dev/disk0s1 /Volumes/EFI

EFI volume appears but.....

Clover install package don't see it

Carbon copy cloner also so I can't install Clover or restaure partition from archive......

 

I did not find

tip: useful information can be found in the answer marked as best, aka the one with a green check symbol.

 

 

Mount as HFS is denied

bash-3.2# mount_hfs /dev/disk0s1 /Volumes/EFI

mount_hfs: Invalid argument

 

Leon

 

As others already said, you must use msdos FAT32 and not HFS filesystem !

 

Backup your whole CLOVER folder first if you have one and try this :

sudo umount /dev/disk0s1
sudo newfs_msdos -v EFI -F 32 /dev/rdisk0s1

Do not mount the EFI partition again for now !

 

Install Clover in the ESP with your usual settings.

 

Now you can mount the EFI partition (if Clover's installer didn't did it automatically) :

sudo mkdir /Volumes/EFI
sudo mount -t msdos /dev/disk0s1 /Volumes/EFI

Finally, replace the whole CLOVER folder by the one you've just backed-up.

Link to comment
Share on other sites

Thank you Polizargone

but trying to mount EFI gave me

 

bash-3.2# mount -t msdos /dev/disk0s1 /Volumes/EFI
mount_msdos: Unsupported sector size (0)

 

This is probably from 4096 bytes sectors on disk

How to progress ?

 

Leon

Link to comment
Share on other sites

This is probably from 4096 bytes sectors on disk

 

I don't think so. I have a 4096 bytes sector HDD and the EFI mounts fine. What's the size of your EFI partition ?

 

Maybe you could share with us the result of :

 

 

diskutil list
Link to comment
Share on other sites

@leon321 

 

perhaps you did not reformat the partition as FAT32?...

 

i tested by formatting my ESP as HFS and trying to mount ... get same error.

 

then i reformat to FAT32 and all is well.

WRONG:

$ sudo newfs_hfs /dev/rdisk1s1
Initialized /dev/rdisk1s1 as a 200 MB case-insensitive HFS Plus volume
tluck@Toms-Mac ~
$ sudo mount -t msdos /dev/disk1s1 /mnt
mount_msdos: Unsupported sector size (0)
tluck@Toms-Mac ~

PROPER:

$ sudo newfs_msdos -v -F 32 /dev/rdisk1s1
newfs_msdos: /dev/32: No such file or directory
tluck@Toms-Mac ~
$ sudo newfs_msdos -v EFI -F 32 /dev/rdisk1s1
4096 bytes per physical sector
/dev/rdisk1s1: 403264 sectors in 403264 FAT32 clusters (512 bytes/cluster)
bps=512 spc=1 res=32 nft=2 mid=0xf8 spt=32 hds=32 hid=40 drv=0x80 bsec=409600 bspf=3152 rdcl=2 infs=1 bkbs=6
tluck@Toms-Mac ~
$ sudo mount -t msdos /dev/disk1s1 /mnt
Link to comment
Share on other sites

Thank you both of you taking care of a poor lost dog in clover forest :-)

 

Size of EFI is 209,7 Mb

I reformatted it from gparted ubuntu in FAT 32

 

 

here are diskutil list

2# diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk0
   1:       Microsoft Basic Data EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Snow_Leopard            300.2 GB   disk0s2
   3:                  Apple_HFS Yosemite                299.8 GB   disk0s3
   4:                  Apple_HFS El capitan              299.5 GB   disk0s4
   5:                 Apple_Boot Recovery HD             650.0 MB   disk0s5
   6:                  Apple_HFS Mav10.9.5               300.0 GB   disk0s6
   7:                  Apple_HFS Tresor                  300.0 GB   disk0s7
   8:                  Apple_HFS Spare                   499.4 GB   disk0s8
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *2.0 TB     disk1
   1:               Windows_NTFS                         224.5 GB   disk1s1
   2:             Windows_FAT_32 CLOVERLW7               210.8 MB   disk1s2
   3:               Windows_NTFS W8                      104.9 GB   disk1s3
   4:               Windows_NTFS HP_Margot               104.9 GB   disk1s5
   5:               Windows_NTFS Acronis Bkup            104.9 GB   disk1s6
   6:                  Apple_HFS BackupMacOs             702.5 GB   disk1s7
   7:                  Apple_HFS BK_Time_machine         654.7 GB   disk1s8
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *15.9 GB    disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS Install Mavericks       15.6 GB    disk2s2

 

 

Now about the second post:

newfs_msdos -v EFI -F 32 /dev/rdisk0s1
4096 bytes per physical sector
/dev/rdisk0s1: 403264 sectors in 403264 FAT32 clusters (512 bytes/cluster)
bps=512 spc=1 res=32 nft=2 mid=0xf8 spt=32 hds=32 hid=40 drv=0x80 bsec=409600 bspf=3152 rdcl=2 infs=1 bkbs=6

 

Now trying to mount

bash-3.2# mount -t msdos /dev/disk1s1 /Volumes/EFI
mount_msdos: Unsupported sector size (0)

 

But I can mount it from Disk utility so I can go further, I Will update.

 

I am sure sectors are 4096 bytes on my 2 To HDD

 

Leon
 

Link to comment
Share on other sites

Guys should be nice to open a new Topic, also in the "Clover" section, on "how to fix a bad EFI partition"... any volunteers?

 

Sure. Let's the OP do this !

 

Hint :

 

 

 

1:       Microsoft Basic Data EFI                     209.7 MB   disk0s1

 

Should be :

 

1:       EFI EFI                     209.7 MB   disk0s1

 

 

  • Like 1
Link to comment
Share on other sites

Guys should be nice to open a new Topic, also in the "Clover" section, on "how to fix a bad EFI partition"... any volunteers?

As much as I would like to do so, I'm not allowed to start topics in such sub-forums as clover.

Thank you both of you taking care of a poor lost dog in clover forest :-)

 

Size of EFI is 209,7 Mb

I reformatted it from gparted ubuntu in FAT 32

 

 

here are diskutil list

2# diskutil list

/dev/disk0

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *2.0 TB disk0

1: Microsoft Basic Data EFI 209.7 MB disk0s1

2: Apple_HFS Snow_Leopard 300.2 GB disk0s2

3: Apple_HFS Yosemite 299.8 GB disk0s3

4: Apple_HFS El capitan 299.5 GB disk0s4

5: Apple_Boot Recovery HD 650.0 MB disk0s5

6: Apple_HFS Mav10.9.5 300.0 GB disk0s6

7: Apple_HFS Tresor 300.0 GB disk0s7

8: Apple_HFS Spare 499.4 GB disk0s8

/dev/disk1

#: TYPE NAME SIZE IDENTIFIER

0: FDisk_partition_scheme *2.0 TB disk1

1: Windows_NTFS 224.5 GB disk1s1

2: Windows_FAT_32 CLOVERLW7 210.8 MB disk1s2

3: Windows_NTFS W8 104.9 GB disk1s3

4: Windows_NTFS HP_Margot 104.9 GB disk1s5

5: Windows_NTFS Acronis Bkup 104.9 GB disk1s6

6: Apple_HFS BackupMacOs 702.5 GB disk1s7

7: Apple_HFS BK_Time_machine 654.7 GB disk1s8

/dev/disk2

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *15.9 GB disk2

1: EFI EFI 209.7 MB disk2s1

2: Apple_HFS Install Mavericks 15.6 GB disk2s2

 

 

Now about the second post:

newfs_msdos -v EFI -F 32 /dev/rdisk0s1

4096 bytes per physical sector

/dev/rdisk0s1: 403264 sectors in 403264 FAT32 clusters (512 bytes/cluster)

bps=512 spc=1 res=32 nft=2 mid=0xf8 spt=32 hds=32 hid=40 drv=0x80 bsec=409600 bspf=3152 rdcl=2 infs=1 bkbs=6

 

Now trying to mount

bash-3.2# mount -t msdos /dev/disk1s1 /Volumes/EFI

mount_msdos: Unsupported sector size (0)

 

But I can mount it from Disk utility so I can go further, I Will update.

 

I am sure sectors are 4096 bytes on my 2 To HDD

 

Leon

You should boot into the Mac Os installer from a USB "drive", so to speak, and perform the described actions in the link I mentioned earlier, there's a freaking command, "gpt", that does everything for you, don't complicate your problem more. Your ESP is of wrong type.

 

Important Hint: You can start the terminal app from the utilities menu.

 

Furthermore, don't use any carbon and whatever software to restore data to your ESP, make it work first then install a fresh copy of clover on it.

 

Best of luck.

Link to comment
Share on other sites

As much as I would like to do so, I'm not allowed to start topics in such sub-forums as clover.

Yep sorry fixed (owner of this new Topic is the OP) and moved related ESP problems here from "Clover General Discussion". 

@leon321 you can customize the first post as you like..

  • Like 1
Link to comment
Share on other sites

Greetings fellows,

Below is an useful link.

What is not mentioned is that you should boot from a different disk than the one you want to fix the ESP.

Proceed with caution.

http://apple.stackexchange.com/questions/57597/how-to-fix-broken-efi-partition

Best regards.

  • Like 1
Link to comment
Share on other sites

Using gdisk, there's no need to boot off an USB stick. You can fix it "on the fly" !

 

Just type this :

 

Make sure that disk0 is the correct disk where the ESP you want to fix is. Use diskutil list to check this before proceeding !!!

sudo gdisk /dev/disk0
Type :

 

p

 

To display available partitions.

 

Then type :

 

t

 

To change a partition type code.

 

Select the partition # (should be 1 in your case) then :

 

L

 

To see available partition's types.

 

 

 

0700 Microsoft basic data  0c01 Microsoft reserved    2700 Windows RE         

3000 ONIE boot             3001 ONIE config           4100 PowerPC PReP boot  

4200 Windows LDM data      4201 Windows LDM metadata  4202 Windows Storage Spac

7501 IBM GPFS              7f00 ChromeOS kernel       7f01 ChromeOS root      

7f02 ChromeOS reserved     8200 Linux swap            8300 Linux filesystem   

8301 Linux reserved        8302 Linux /home           8303 Linux x86 root (/) 

8304 Linux x86-64 root (/  8305 Linux ARM64 root (/)  8306 Linux /srv         

8400 Intel Rapid Start     8e00 Linux LVM             a500 FreeBSD disklabel  

a501 FreeBSD boot          a502 FreeBSD swap          a503 FreeBSD UFS        

a504 FreeBSD ZFS           a505 FreeBSD Vinum/RAID    a580 Midnight BSD data  

a581 Midnight BSD boot     a582 Midnight BSD swap     a583 Midnight BSD UFS   

a584 Midnight BSD ZFS      a585 Midnight BSD Vinum    a601 OpenBSD data       

a800 Apple UFS             a901 NetBSD swap           a902 NetBSD FFS         

a903 NetBSD LFS            a904 NetBSD concatenated   a905 NetBSD encrypted   

a906 NetBSD RAID           ab00 Apple boot            af00 Apple HFS/HFS+     

af01 Apple RAID            af02 Apple RAID offline    af03 Apple label        

af04 AppleTV recovery      af05 Apple Core Storage    be00 Solaris boot       

bf00 Solaris root          bf01 Solaris /usr & Mac Z  bf02 Solaris swap       

bf03 Solaris backup        bf04 Solaris /var          bf05 Solaris /home      

bf06 Solaris alternate se  bf07 Solaris Reserved 1    bf08 Solaris Reserved 2 

bf09 Solaris Reserved 3    bf0a Solaris Reserved 4    bf0b Solaris Reserved 5 

Press the <Enter> key to see more codes:

c001 HP-UX data            c002 HP-UX service         ea00 Freedesktop $BOOT  

eb00 Haiku BFS             ed00 Sony system partitio  ed01 Lenovo system partit

ef00 EFI System            ef01 MBR partition scheme  ef02 BIOS boot partition

f800 Ceph OSD              f801 Ceph dm-crypt OSD     f802 Ceph journal       

f803 Ceph dm-crypt journa  f804 Ceph disk in creatio  f805 Ceph dm-crypt disk i

fb00 VMWare VMFS           fb01 VMWare reserved       fc00 VMWare kcore crash p

fd00 Linux RAID

 

 

Choose ef00 EFI System

 

Then :

 

w

 

To write changes on the partition map. And finally :

 

q

 

To quit gdisk.

 

Your ESP should now have the correct partition type. Run disktutil list once again to check it.

 

You should see :

 

1:       EFI EFI                     209.7 MB   disk0s1

 

instead of :

 

1:       Microsoft Basic Data EFI                     209.7 MB   disk0s1

  • Like 1
Link to comment
Share on other sites

Micky1979 thanks for moving this discussion to the right place.

 

Needy, I did what is indicated in the provded link and still can't mount EFI partition

 

Polyzargone, thank you  for your input.

 

I did it and now

#:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS Snow_Leopard            300.2 GB   disk1s2
   3:                  Apple_HFS Yosemite                299.8 GB   disk1s3
   4:                  Apple_HFS El capitan              299.5 GB   disk1s4
   5:                 Apple_Boot Recovery HD             650.0 MB   disk1s5
   6:                  Apple_HFS Mav10.9.5               300.0 GB   disk1s6
   7:                  Apple_HFS Tresor                  300.0 GB   disk1s7
   8:                  Apple_HFS Spare                   499.4 GB   disk1s8

 

Now I want to mount this EFI:

 

mount -t msdos /dev/disk1s1 /Volumes/EFI
mount_msdos: Unsupported sector size (49294)

 

bash-3.2# mount -t EFI /dev/disk1s1 /Volumes/EFI
mount: exec /System/Library/Filesystems/EFI.fs/Contents/Resources/mount_EFI for /Volumes/EFI: No such file or directory

 

bash-3.2# mount -t ef00 /dev/disk1s1 /Volumes/EFI
mount: exec /System/Library/Filesystems/ef00.fs/Contents/Resources/mount_ef00 for /Volumes/EFI: No such file or directory

 

i did not find the way to mount it from terminal...

but I did it from Clover configurator.......

 

 

But going back to Clover installation package I found that EFI must be formated in FAT 32

see :

Install Clover in the ESP (EFI System Partition) of the target volume

Need to format ESP as Fat32 on Mac first.

 

I did it and it's working again

 

Thanks a lot to all

 

 

Leon

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...