3

Aaargh. After days of reading and trying everything I'm still stuck in a maze. It should be simple but I cannot work it out.

I need to create one bootable UEFI disk partition that contains all the space on the disk. The steps must work in a shell script. Ideally with syslinux/extlinux but if not possible then grub.

How to do this? Surely it should be dead easy, a handful of lines? Nothing I do works.

This is what I have so far:

DISK_DEVICE_NAME_CURRENT_OS=hda
echo remove all partitions
sudo /usr/local/sbin/sgdisk -Z /dev/${DISK_DEVICE_NAME_CURRENT_OS}
echo create GPT partition
sudo /usr/local/sbin/sgdisk -n 1:: /dev/${DISK_DEVICE_NAME_CURRENT_OS}
echo format file system
sudo mkfs.ext4 -F /dev/${DISK_DEVICE_NAME_CURRENT_OS}1
sudo mkdir -p /mnt/target
sudo mount /dev/${DISK_DEVICE_NAME_CURRENT_OS}1 /mnt/target
sudo mkdir -p  /mnt/target/boot
sudo /usr/local/sbin/extlinux --install /mnt/target/boot
sudo dd if=/usr/local/share/syslinux/gptmbr.bin of=/dev/${DISK_DEVICE_NAME_CURRENT_OS}

When I boot, it says:

Booting from Hard Disk. Missing OS. No bootable device.

Any suggestions please as to how I can get this disk to boot?

thanks

2
  • 1
    I think that a UEFI boot partition cannot be ext4, I may be wrong about this though.
    – Didi Kohen
    Commented Nov 7, 2016 at 9:39
  • 2
    It is correct, a UEFI boot partition must be "based on the FAT file system" (usually contains a FAT32 file system) and could not use the whole disk.
    – user232326
    Commented Nov 7, 2016 at 11:01

1 Answer 1

4

Please use Gparted to create a gpt based disk (not ms-dos, older partitions).

  • Create a new partition table (gpt type).
  • Have a EFI system partition (ESP)
  • Create the remaining partitions needed for the OS and boot the installation media in UEFI mode. To boot linux: usually /boot, /, and swap.

Please read:

UEFI partitioning for dummies
EFI System Partition

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .