sdb is our target in this example.
1. Create partition and set ESP flag
# parted /dev/sdb GNU Parted 3.2 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel gpt Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes (parted) mkpart Partition name? []? File system type? [ext2]? fat32 Start? 0% End? 100% (parted) set 1 esp on (parted) p Model: QEMU QEMU HARDDISK (scsi) Disk /dev/sdb: 17.2GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 17.2GB 17.2GB fat32 boot, esp (parted) q Information: You may need to update /etc/fstab
2. Format partition with volume label (11 characters or less, app caps; eg: CENTOSEFI)
# mkfs.vfat -v -n CENTOSEFI /dev/sdb1 mkfs.fat 4.1 (2017-01-24) Auto-selecting FAT32 for large filesystem /dev/sdb1 has 64 heads and 32 sectors per track, hidden sectors 0x0800; logical sector size is 512, using 0xf8 media descriptor, with 33550336 sectors; drive number 0x80; filesystem has 2 32-bit FATs and 16 sectors per cluster. FAT size is 16368 sectors, and provides 2094848 clusters. There are 32 reserved sectors. Volume ID is 2710dd05, volume label CENTOSEFI .
3. Copy ISO content to USB
# mount /repo/ISO/CentOS-7-x86_64-Everything-1810.iso /mnt/iso/ mount: /mnt/iso: WARNING: device write-protected, mounted read-only. # mount /dev/sdb1 /mnt/usb/ # rsync -a /mnt/iso/ /mnt/usb/
4. Edit /mnt/usb/EFI/BOOT/grub.cfg to match volume label
[root@hk181vm BOOT]# diff grub.cfg grub.cfg-before 24c24 < linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CENTOS7USB --- > linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet 28c28 < linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CENTOS7USB rd.live.check --- > linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet 33c33 < linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CENTOS7USB xdriver=vesa nomodeset --- > linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 xdriver=vesa nomodeset quiet 37c37 < linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CENTOS7USB rescue --- > linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rescue quiet
5. sync and umount