User:WavyEbuilder/Gentoo Hardened Verified Boot Install/Disk Setup

From Gentoo Wiki
Jump to:navigation Jump to:search

Firstly, we need to setup our disks. I'll operate under the assumption the block device being operated on is /dev/nvme0n1, so make sure to substitute that for your real block device.

Partition Layout

The table below below shows the partition layout we will be using:

Partition Size Gdisk Hex Code Filesystem Description Mountpoint
/dev/nvme0n1p1 512 MB EF00 Fat32 EFI System Partition /efi
/dev/nvme0n1p2 4 GB EA00 Fat32 XBOOTLDR Partition /boot
/dev/nvme0n1p3 Ram Size 8200 Swap Swap Partition [SWAP]
/dev/nvme0n1p4 50 GB 8314 LUKS + BTRFS Linux x86-64 /usr Partition /usr
/dev/nvme0n1p5 5 GB (10% of /usr) 8319 Verity Linux x86-64 /usr verity [VERITY]
/dev/nvme0n1p6 Rest of Drive 8304 LUKS + BTRFS Linux x86-64 root (/) /

While swap is optional, it is recommended to at least have 8 GB. For hibernation to work, you'll need at least the amount of swap as system memory. /usr is recommended to be at least 50 GB, however users with a smaller disk size should be able to get away with 20 GB.

Partitioning Drives

Now its time to partition our drives according to our partition layout:

root #sgdisk -Z -o /dev/nvme0n1 \
-n 1::+512M -t 1:EF00 -c 1:"esp" \
-n 2::+4G -t 2:EA00 -c 2:"boot" \
-n 3::+$(free -g | awk '/^Mem:/{print $2}')G -t 3:8200 -c 3:"swap" \
-n 4::+50G -t 4:8314 -c 4:"usr" \
-n 5::+6G -t 5:8319 -c 5:"usr_verity" \
-n 6::: -t 6:8304 -c 6:"root" && \
echo -e "SUCCESS"
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
The operation has completed successfully.
SUCCESS