uefi-parted.sh 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. # Prepare nvme disk with the layout:
  2. # - 301 MB partition for EFI
  3. # - 50 GB root partition for the OS (includes /boot)
  4. # - Remaining disk left to create a luks container
  5. disk="/dev/nvme0n1"
  6. # Cleanup existing partition tables
  7. #dd if=/dev/zero of=$disk bs=512 count=34
  8. # Prepare partition tables and partitions
  9. # -parted does not accept blanks in partition names
  10. parted $disk --script \
  11. mklabel gpt \
  12. mkpart EFI_system_partition fat32 1MiB 301MiB \
  13. set 1 esp on \
  14. set 1 boot on \
  15. align-check optimal 1 \
  16. mkpart Linux_system_parition ext4 301MiB 50GiB \
  17. align-check optimal 2 \
  18. mkpart Data_partion 50GiB 100% \
  19. align-check optimal 3 \
  20. unit MiB \
  21. print
  22. # Make file systems
  23. mkfs.fat -F 32 -n EFIBOOT $disk"p1" && fsck $disk"p1"
  24. mkfs.ext4 $disk"p2" && fsck $disk"p2"