gdisk

Gdisk is more like a interactive tool. Below is the setup for a BIOS/GPT configuration

o #create new table
n [default] [+1M] [ef02] # create a 1MiB space for grub
n [default] [+20G] [8300] # create rootfs
n [default] [+4G] [8200] # create swap
n [default] [+20G] [8300] # create home
n [default] [default] [8300] # remaining is used by other os
w

And here is a partition scheme for UEFI/GPT configuration:

/dev/sda1 100M UEFI ef00
/dev/sda2 1000M Boot 8000
/dev/sda3 20G Root 8304
/dev/sda4 20G Home 8300
/dev/sda5 4G Swap 8200

Notes on Linux Installation on a BIOS/GPT configuration

A mebibyte partition needs to be located in first 2TB of the disk. For details, check arch wiki arch wiki

Btrfs

需要为btrfs创建2个子卷,一个供boot使用,一个供home使用

mount /dev/sda2 /mnt
cd /mnt
mount -t btrfs -o compress=lzo /dev/sda2 /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@snapshots

此时umount /dev/sda2

然后

mount -o compress=lzo,subvol=@ /dev/sda2 /mnt
mkdir -p /mnt/home
mount -o compress=lzo,subvol=@home /dev/sda2 /mnt/home
mkdir -p /mnt/.snapshots
mount -o compress=lzo,subvol=@snapshots /dev/sda2 /mnt/.snapshots
mkdir -p /var
btrfs subvolume create /mnt/var/tmp
btrfs subvolume create /mnt/tmp