69 lines
1.1 KiB
Markdown
69 lines
1.1 KiB
Markdown
# Creating a bootable USB UEFI stick
|
|
|
|
## Identify the drive
|
|
|
|
Insert your USB stick and tail /var/log/messages to find out the device name.
|
|
Then set the device name in a variable
|
|
|
|
|
|
```
|
|
DRIVE=/dev/sdc
|
|
```
|
|
|
|
|
|
## Initial formatting of the USB stick
|
|
|
|
This is a one-time operation. When updating the USB stick
|
|
this step can be skipped.
|
|
|
|
|
|
Formatting:
|
|
* gpt partition table
|
|
* primary partition of type ext2
|
|
* primary partition of type EFI (EF)
|
|
* label /dev/sdc1 as RESCUE
|
|
|
|
```
|
|
parted ${DRIVE}
|
|
```
|
|
|
|
Create partitions in parted:
|
|
```
|
|
mktable gpt
|
|
mkpart primary ext2 1 512MB
|
|
mkpart primary fat32 512MB 1024MB
|
|
set 2 boot on
|
|
```
|
|
|
|
|
|
Format the partitions:
|
|
```
|
|
mkfs.ext2 ${DRIVE}1 # this will contain the images.
|
|
mkfs.vfat ${DRIVE}2 # this will contain the UEFI bootloader and grub.cfg
|
|
e2label ${DRIVE}1 RESCUE # label the partition
|
|
```
|
|
|
|
## Synchronize files to the USB stick
|
|
|
|
|
|
Sync images:
|
|
```
|
|
mount ${DRIVE}1 /mnt/tmp
|
|
mkdir -p /mnt/tmp/images
|
|
rsync -av images/ /mnt/tmp/images/
|
|
umount /mnt/tmp
|
|
```
|
|
|
|
Sync the grub configuration:
|
|
```
|
|
mount ${DRIVE}2 /mnt/tmp
|
|
mkdir -p /mnt/tmp/EFI
|
|
rsync -av EFI/ /mnt/tmp/EFI/
|
|
umount /mnt/tmp
|
|
```
|
|
|
|
|
|
|
|
|
|
|