Italiano English
Edit History Actions

Diff for "Hybrid_UEFI_MBR_USB_Drive"

Differences between revisions 6 and 7
Revision 6 as of 2016-09-14 13:24:31
Size: 5598
Editor: 91
Comment:
Revision 7 as of 2016-09-14 13:28:55
Size: 5692
Editor: 91
Comment:
Deletions are marked like this. Additions are marked like this.
Line 82: Line 82:
`Command (? for help): w `Command (? for help):` '''w''' <<BR>>
Line 84: Line 84:
`Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
`PARTITIONS!!
`Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING`<<BR>>
`PARTITIONS!!`<<BR>>
Line 106: Line 106:
`Recovery/transformation command (? for help): h`<<BR>> `Recovery/transformation command (? for help):`''' h'''<<BR>>
Line 113: Line 113:
`added to the hybrid MBR, in sequence: 1 2 3`<<BR>>
`Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): n`<<BR>>
`added to the hybrid MBR, in sequence:` '''1 2 3'''<<BR>>
`Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N):` '''n'''<<BR>>
Line 117: Line 117:
`Enter an MBR hex code (default EF): EF02`<<BR>>
`Set the bootable flag? (Y/N): n`<<BR>>
`Enter an MBR hex code (default EF):` '''EF02'''<<BR>>
`Set the bootable flag? (Y/N):` '''n'''<<BR>>
Line 121: Line 121:
`Enter an MBR hex code (default EF): EF00`<<BR>>
`Set the bootable flag? (Y/N): n`<<BR>>
`Enter an MBR hex code (default EF):` '''EF00'''<<BR>>
`Set the bootable flag? (Y/N):` '''n'''<<BR>>
Line 125: Line 125:
`Enter an MBR hex code (default 07): 0700`<<BR>>
`Set the bootable flag? (Y/N): y`<<BR>>
`Enter an MBR hex code (default 07):` '''0700'''<<BR>>
`Set the bootable flag? (Y/N):` '''y'''<<BR>>
Line 128: Line 128:
`Recovery/transformation command (? for help): w`<<BR>> `Recovery/transformation command (? for help):` '''w'''<<BR>>
Line 133: Line 133:
`Do you want to proceed? (Y/N): y`<<BR>> `Do you want to proceed? (Y/N):` '''y'''<<BR>>

An Hybrid UEFI GPT + BIOS GPT/MBR boot USB disk is a disk that works on both UEFI and BIOS PCs.

Requisites:

A working Linux installation with the following packages: grub2, grub2-efi, gdisk (on Debian Jessie: grub-pc-bin, grub-efi, grub-efi-amd64, gdisk) An USB drive Some Linux ISO.

Step 1: get the proper /dev

From now on we will use a root shell because almost all commands we will use require it.

root@debianvm:~# fdisk -l

...............

Disk /dev/sdc: 14.9 GiB, 16005464064 bytes, 31260672 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1           2 31260671 31260670 14.9G af HFS / HFS+

Find the right dev (ie: mine was /dev/sdc and i will use it in the guide).

Step 2: make GUID partition table and partitions

root@debianvm:~# gdisk /dev/sdc
And then we are in gdisk prompt; from now on just give the commands in bold and the press enter.

GPT fdisk (gdisk) version 0.8.10

Partition table scan:

  • MBR: MBR only
    BSD: not present
    APM: not present
    GPT: not present

***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************

Warning! Main partition table overlaps the first partition by 32 blocks!
You will need to delete this partition or resize it in another utility.

Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.

Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n Partition number (1-128, default 1): 
First sector (34-31260638, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-31260638, default = 31260638) or {+-}size{KMGTP}: +1M
Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): EF02
Changed type of partition to 'BIOS boot partition'

Command (? for help): n
Partition number (2-128, default 2):
First sector (34-31260638, default = 4096) or {+-}size{KMGTP}:
Last sector (4096-31260638, default = 31260638) or {+-}size{KMGTP}: +50M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): EF00
Changed type of partition to 'EFI System'

Command (? for help): n
Partition number (3-128, default 3):
First sector (34-31260638, default = 106496) or {+-}size{KMGTP}:
Last sector (106496-31260638, default = 31260638) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 0700
Changed type of partition to 'Microsoft basic data'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdc.
The operation has completed successfully.
Now gdisk will quit, it's ok.

Step 3: make hybrid GUID/MBR

root@debianvm:~# gdisk /dev/sdc
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): r

Recovery/transformation command (? for help): h

WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
just hit the Enter key at the below prompt and your MBR partition table will
be untouched.

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 1 2 3
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): n

Creating entry for GPT partition #1 (MBR partition #1)
Enter an MBR hex code (default EF): EF02
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default EF): EF00
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #3 (MBR partition #3)
Enter an MBR hex code (default 07): 0700
Set the bootable flag? (Y/N): y

Recovery/transformation command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdc.
The operation has completed successfully.