codeitlikemiley / arch-btrfs-snapper

My Archlinux Installer Guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Special Arch Install With BTRFS on UEFI

Archlinux always break, if it break , you can easily rollback with BTRFS and Snapper Even if your system is unbootable

  1. set wifi password
wifi-menu
  1. set mirror list
vim /etc/pacman.d/mirrorlist
# add this to /etc/pacman.d/mirrorlist
# generate your mirrorlist @ https://www.archlinux.org/mirrorlist/
Server = http://mirror.rise.ph/archlinux/$repo/os/$arch
  1. Update Packages
pacman -Syu
  1. Set Keyboard Layout

  2. Partition SSD

fdisk -l /dev/nvme0n1
cfdisk /dev/nvme0n1
# DELETE ALL CURRENT PARTION SET new Partition as such
/dev/nvme0n1p1 ->type = EFI System
/dev/nvme0n1p2 ->type = Linux Filesystem
/dev/nvme0n1p3 ->type = Linux Filesystem
 /dev/nvme0n1p4 ->type = Linux Swap
  1. format disk
mkfs.vfat -F 32 -n EFI /dev/nvme0n1p1
mkfs.btrfs -L ROOT /dev/nvme0n1p2
mkfs.xfs -L HOME /dev/nvme0n1p3
mkswap -L SWAP /dev/nvme0n1p4
  1. set BTRFS on btrfs partition
mount /dev/nvme0n1p2 /mnt
btrfs sub cr /mnt/@
btrfs sub cr /mnt/@log
btrfs sub cr /mnt/@pkg
btrfs sub cr /mnt/@snapshots
  1. Unmount
umount /mnt
  1. Mount BTRFS
mount -o relatime,space_cache=v2,compress=lzo,subvol=@ /dev/nvme0n1p2 /mnt
mkdir -p /mnt/{boot/efi,home,var/log,var/cache/pacman/pkg,btrfs}
mount -o relatime,space_cache=v2,compress=lzo,subvol=@log /dev/nvme0n1p2 /mnt/var/log
mount -o relatime,space_cache=v2,compress=lzo,subvol=@pkg /dev/nvme0n1p2 /mnt/var/cache/pacman/pkg/
mount -o relatime,space_cache=v2,compress=lzo,subvolid=5 /dev/nvme0n1p2 /mnt/btrfs
mount /dev/nvme0n1p1 /mnt/boot/efi/
mount /dev/nvme0n1p3 /mnt/home/
swapon /dev/nvme0n1p4
  1. Check partition
df -Th
# check memory
free -h
  1. Install Arch and Packages
acstrap /mnt base base-devel bash-completion vim dialog btrfs-progs xfsprogs dosfstools grub efibootmgr linux-lts linux-firmware man-db man-pages inetutils netctl intel-ucode snapper grub networkmanager
  1. review this command if we need to use wifi-menu not part of installation process
pacman -S wpa_supplicant dialog iw
  1. Generate FSTAB
genfstab -U /mnt >> /mnt/etc/fstab
# check the file
# remove the line for ROOT partition
cat /mnt/etc/fstab
  1. GO INSIDE ARCH INSTALLED MACHINE (CHROOT)
arch-chroot /mnt
  1. Set time zone
ln -sf /usr/share/zoneinfo/Asia/Manila /etc/localtime
  1. set hwclock
hwclock --systohc
  1. localization
vim /etc/locale.gen
  1. Uncomment en_US.UTF-8 UTF-8 and other needed locales in /etc/locale.gen
vim /etc/locale.conf
  1. add on /etc/locale.conf
LANG=en_US.UTF-8
  1. set hostname
vim /etc/hostname
  1. Add hostname
dev
  1. edit /etc/hosts
vim /etc/hosts
  1. add this to /etc/hosts
127.0.0.1	localhost
::1		localhost
127.0.1.1	dev.localdomain	dev
  1. create the grub folder
cd /boot
mkdir grub
# install grub
pacman -S grub
grub-mkconfig -o /boot/grub/grub.cfg
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub
  1. change root pass
passwd
  1. avoid error on journald.conf
vim /etc/systemd/journald.conf
  1. Update Jourld.conf
Storage=volatile
  1. install network manager
systemctl enable NetworkManager
  1. Install Linux LTS
vim /etc/mkinitcpio.conf
mkinitcpio -p linux-lts
  1. exit on arch-chroot
exit
umount -R /mnt
  1. Add new SUDO User
useradd -m -g wheel uriah
passwd uriah
vim /etc/sudoers

Arch After Install

Watch this

  1. Install Snapper
pacman -S snapper
snapper -c root create-config /
btrfs sub del /.snapshots/
mkdir /.snapshots
  1. Update Fstab
vim  /etc/fstab
add entry of .snapshots wuth subvol=@snapshots
mount /.snapshots/
df -Th
snapper list
  1. Update Grub
pacman -S grub-btrfs
# open this file
vim /etc/grub.d/41_snapshots-btrfs

/etc/grub.d/41_snapshots-btrfs update this file

Set harmonized entries true on /etc/default/grub
GRUB_BTRFS_CREATE_ONLY_HARMONIZED_ENTRIES="true"
GRUB_BTRFS_LIMIT="10"
  1. Edit Root Snapper Config

vim /etc/snapper/configs/root

NUMBER_CLEANUP="yes"
NUMBER_MIN_AGE="0"
NUMBER_LIMIT="12"
NUMBER_LIMIT_IMPORTANT="3"

TIMELINE_CREATE="no"
  1. Check if Cron job is working
systemctl status cronie.service
#this should be running

Installing Snapper Hooks

sudo pacman -S snap-pac
Yay -y snap-pac-grub

there will be pre-and-post snapshots everytime you install new pacman package

About

My Archlinux Installer Guide