Forked from renich/00-gentoo-installation-partitioning.bash
Last active
September 23, 2020 08:07
-
-
Save Thomashrb/ee1898941e67a0dd0fd220fd8f999650 to your computer and use it in GitHub Desktop.
Install Gentoo Desktop into BtrFS subvolumes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## PARTITION DISKS | |
################## | |
# zap-all and clear partition table | |
sgdisk -Z /dev/sda && sgdisk -o /dev/sda | |
# create bios_grub partition | |
sgdisk -n 1::+8M -t 1:ef02 /dev/sda | |
# create boot partition | |
sgdisk -n 2::+512M -t 2:8300 /dev/sda | |
# create root partition | |
sgdisk -n 3:: -t 3:8300 /dev/sda | |
## CREATE FILESYSTEMS | |
##################### | |
mkfs.vfat /dev/sda1 | |
mkfs.ext2 /dev/sda2 | |
mkfs.btrfs -L btrfsroot /dev/sda3 | |
## CREATE SUBVOLS | |
################# | |
mkdir /mnt/gentoo | |
mount /dev/sda3 /mnt/gentoo | |
cd /mnt/gentoo | |
btrfs subvol create root | |
btrfs subvol create home | |
btrfs subvol create var | |
btrfs subvol create snapshots | |
cd .. | |
umount gentoo | |
## MOUNT VOLUMES | |
################ | |
mount -o defaults,noatime,compress=lzo,ssd,subvol=root /dev/sda3 /mnt/gentoo | |
## create dirs for mounts | |
cd /mnt/gentoo | |
mkdir home root var boot snapshots | |
## mount | |
mount -o defaults,noatime,compress=lzo,ssd,subvol=home /dev/sda3 /mnt/gentoo/home | |
mount -o defaults,noatime,compress=lzo,ssd,subvol=var /dev/sda3 /mnt/gentoo/var | |
mount -o defaults,noatime,compress=lzo,ssd,subvol=snapshots /dev/sda3 /mnt/gentoo/snapshots | |
mount -o defaults,noatime /dev/sda2 /mnt/gentoo/boot | |
# disable CoW for var | |
chattr -R +C /mnt/gentoo/var |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment