Multiboot USB
Setup
Device Discovery
Run fdisk -l:
... Disk /dev/sda: 30.8 GB, 30752000000 bytes, 60062500 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 Disk label type: gpt # Start End Size Type Name 1 2048 411647 200M EFI System EFI System 2 411648 60062466 28.5G Linux filesyste Linux filesystem
or lsblk -f (we'll be using lsblk later so maybe time to get used to it):
# lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT sda ├─sda1 vfat F3AA-CA9F /tmp/usb-sda/boot/efi └─sda2 xfs 786ac5ec-1d5b-4e8e-871e-cd6c0afd7fe4 /tmp/usb-sda ...
Here we have figured out that the USB stick is sda and can see the result of a previous run of our partitioning efforts.
Note
For anyone wondering how the USB stick is sda, aka. the first disk the answer is that this machine has booted off an NVMe disk which CentOS is picking up as the nvme0n1 device leaving sd<x> available for use for removable media.
Device Reset
We can (perhaps should) clear things up so we have a clean shot:
dd if=/dev/zero of=/dev/sda bs=$((1024*1024)) count=1000
Here, we're slapping NULs over the first GiB which should trample over the MBR and primary GPT blocks. This won't destroy the secondary GPT blocks as they are at the end of the disk. However, we want this to finish today (even if it is USB 3.0).
Warning
If you have a large amount of RAM the command will finish faster than you think as the data is sat in cache waiting to be synced to disk. Wait for it all to finish flushing out:
# time sync real 0m17.754s user 0m0.000s sys 0m0.019s
Check we've cleaned things up:
# lsblk -f /dev/sda NAME FSTYPE LABEL UUID MOUNTPOINT sda ├─sda1 vfat F3AA-CA9F /tmp/usb-sda/boot/efi └─sda2 xfs 786ac5ec-1d5b-4e8e-871e-cd6c0afd7fe4 /tmp/usb-sda
Eh? It's all still there! Sadly, the kernel hangs on to the information. We might need to reboot...
# lsblk -f /dev/sda NAME FSTYPE LABEL UUID MOUNTPOINT sda
Phew!
Additional Packages
We'll be using gdisk (the GPT equivalent to fdisk) and we'll need some GRUB2 EFI modules for x86_64:
yum -y install gdisk grub2-efi-modules
Document Actions