Bootable Linux USB stick: Difference between revisions

No edit summary
Line 22: Line 22:




== Howto create a bootabled GPT-partitioned USB-stick with Fedora 23 ==
== How to create a bootabled GPT-partitioned USB-stick with Fedora 23 ==
   
   
This will create a USB stick capable to
This will create a USB stick capable to
* EFI boot on Mac's
* EFI boot on Macs
* UEFI boot on PC's
* UEFI boot on PCs
* BIOS boot on newer hardware (legacy boot / CSM enabled)
* BIOS boot on newer hardware (legacy boot / CSM enabled in BIOS)
* BIOS boots on medium aged bios hardware
* BIOS boot on medium aged hardware
does not boot on old BIOS hardware which doesn't support booting from GPT (see below):
* not boot on really old BIOS hardware which doesn't support booting from GPT (see below)


=== GPT partition the stick using gdisk ===
=== GPT partition the stick using gdisk ===
The example shows a 32 GB Sandisk Extreme:
The example shows a 32 GB Sandisk Extreme:
  Part 1: +1G VFAT (0700) (Windows needs it to be the first partition)  
  Part 1: +1G VFAT       (0700) (Windows needs it to be the first partition)  
  Part 2: +1M Biosboot (ef02)
  Part 2: +1M Biosboot   (ef02)
  Part 3: +250M EFI (ef00)
  Part 3: +250M EFI       (ef00)
  Part 4: +13500M / (0083)
  Part 4: +13500M /       (0083)
  Part 5: +15000M /mnt/data (0083)
  Part 5: +15000M /mnt/data (0083)
For performance, make sure that the big partitions are aligned to 8192-sector boundaries; default is 2048-sector boundaries - the default can be adjusted. If you use the above sizes and the + sign for specifying them, this happens to work out automatically.
For performance, make sure that the big partitions are aligned to 8192-sector boundaries; gdisk default is 2048-sector boundaries - the default can be adjusted. If you use the above sizes and the + sign for specifying them, this happens to work out automatically.


=== Install Fedora23 on an UEFI machine (UEFI enabled; LegacyBoot / CSM disabled) ===
=== Install Fedora23 on an UEFI machine (UEFI enabled; LegacyBoot / CSM disabled) ===
Whenever you see a ?, you must fill in the appropriate drive letter (e.g. c or d).  
Whenever you see a ?, you must fill in the appropriate drive letter (e.g. c or d).  
  sd?3: efi       /boot/efi
  sd?3: efi             /boot/efi
  sd?4: ext4 /  
  sd?4: ext4             /  
  sd?5: ext4 /mnt/data
  sd?5: ext4             /mnt/data


=== adjust the USB-stick for UEFI/EFI boot (before reboot from chroot environment) ===
=== adjust the USB-stick for UEFI/EFI boot (before reboot from chroot environment) ===
Line 52: Line 52:


install updates:
install updates:
  dnf -y update
  dnf -y update   # dnf on FC23 is successor to yum


configure grub2 for (U)EFI systems:
configure grub2 for (U)EFI systems:
Line 125: Line 125:
  dd if=/dev/zero of=/mountpoint/delete.me bs=65536  # this will stop when filesystem full
  dd if=/dev/zero of=/mountpoint/delete.me bs=65536  # this will stop when filesystem full
  rm /mountpoint/delete.me
  rm /mountpoint/delete.me
Better: use the (enhanced) SECURITY ERASE UNIT feature of hdparm (quicker, and nicer for the device).  
Better: use the (enhanced) SECURITY ERASE UNIT feature of hdparm (quicker, and nicer for the device, but tricky to use).  


save a compressed disk image - we use the parallel gzip program called pigz:
save a compressed disk image - we use the parallel gzip program called pigz:
1,330

edits