Skip to content

Instantly share code, notes, and snippets.

@io41
Forked from b1-88er/manjaro, btrfs + luks
Last active October 26, 2023 12:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save io41/3098e2b19274d31d08d91a90835c3ef9 to your computer and use it in GitHub Desktop.
Save io41/3098e2b19274d31d08d91a90835c3ef9 to your computer and use it in GitHub Desktop.
# dvorak layout
loadkeys dvorak
export HOSTNAME=thinkpad
export DEVICE=/dev/sda
export EFI_PARTITION=/dev/sda1
export ROOT_PARTITION=/dev/sda2
# as root
timedatectl set-ntp true
# set fastest mirror (-g = geoip lookup country)
rankmirrors -m rank -g --proto https -a
pacman -Syy
gdisk $DEVICE
#o (Create a new empty GUID partition table (GPT))
#Proceed? Y
#n (Add a new partition)
#Partition number 1
#First sector (default)
#Last sector +512M
#Hex code EF00
#n (Add a new partition)
#Partition number 2
#First sector (default)
#Last sector (press Enter to use remaining disk)
#Hex code 8300
#w
#Y
cryptsetup luksFormat $ROOT_PARTITION
cryptsetup open $ROOT_PARTITION cryptroot
mkfs.vfat -F32 $EFI_PARTITION
mkfs.btrfs /dev/mapper/cryptroot
mount /dev/mapper/cryptroot /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@var
umount /mnt
mount -o subvol=@,ssd,compress=lzo,noatime,nodiratime /dev/mapper/cryptroot /mnt
mkdir /mnt/{boot,home,var}
mount -o subvol=@home,ssd,compress=lzo,noatime,nodiratime /dev/mapper/cryptroot /mnt/home
mount -o subvol=@var,ssd,compress=lzo,noatime,nodiratime /dev/mapper/cryptroot /mnt/var
mount $EFI_PARTITION /mnt/boot
pacman -S arch-install-scripts
pacstrap /mnt base base-devel btrfs-progs vim sudo bash bash-completion intel-ucode networkmanager
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
manjaro-chroot /mnt /bin/bash
echo $HOSTNAME > /etc/hostname
ln -sf /usr/share/zoneinfo/Europe/Germany /etc/localtime
hwclock --systohc
vim /etc/locale.gen #uncomment en_IE.UTF-8
locale-gen
echo LANG=en_IE.UTF-8 > /etc/locale.conf
passwd
pacman -S linux51
vim /etc/mkinitcpio.conf
# replace HOOKS line with:
HOOKS=(base systemd autodetect modconf keyboard sd-vconsole modconf block sd-encrypt filesystems)
# add encrypt and btrfs after block
mkinitcpio -p linux51
bootctl --path=/boot install
blkid | grep -i crypto_luks
UUID="uuid from grep above ^"
cat <<EOF > /boot/loader/entries/arch.conf
title manjaro
linux /vmlinuz-5.1-x86_64
initrd /intel-ucode.img
initrd /initramfs-5.1-x86_64.img
options cryptdevice=UUID=${UUID}:luks:allow-discards root=/dev/mapper/luks rootflags=subvol=@ rd.luks.options=discard rw mem_sleep_default=deep
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment