arch btrfs snapper - Forest0923/memo GitHub Wiki
System
-
CPU: Intel
-
UEFI Boot
-
Multi-disk support with btrfs
- Devices:
/dev/vda /dev/vdb /dev/vdc
Commands
Keymap
- Change keymap:
loadkeys jp106
Time
- Timedatectl:
timedatectl set-ntp true
Mirrorlist
- Optimize mirror list:
pacman -Syy
pacman -S reflector # `python` might be required
reflector -c Japan --sort rate -a 6 --save /etc/pacman.d/mirrorlist
Disk formatting
- Partitioning:
gdisk /dev/vda
/dev/vda1: EFI system (200M)
/dev/vda2: Linux filesystem
gdisk /dev/vdb
/dev/vdb1: Linux filesystem
gdisk /dev/vdc
/dev/vdc1: Linux filesystem
- Formattiong:
mkfs.fat -F32 /dev/vda1
mkfs.btrfs /dev/vda2 /dev/vdb1 /dev/vdc1
- Mount:
mount /dev/vda2 /mnt
btrfs su cr /mnt/@
btrfs su cr /mnt/@home
btrfs su cr /mnt/@snapshots
btrfs su cr /mnt/@var_log
umount /mnt
mount -o noatime,compress=lzo,space_cache=v2,subvol=@ /dev/vda2 /mnt
mkdir -p /mnt/{boot,home,.snapshots,var/log}
mount -o noatime,compress=lzo,space_cache=v2,subvol=@home /dev/vda2 /mnt/home
mount -o noatime,compress=lzo,space_cache=v2,subvol=@snapshots /dev/vda2 /mnt/.snapshots
mount -o noatime,compress=lzo,space_cache=v2,subvol=@var_log /dev/vda2 /mnt/var/log
mount /dev/vda1 /mnt/boot
Base install
- Install base package:
pacstrap /mnt base linux linux-firmware intel-ucode vim
Create fstab file
- Generate fstab:
genfstab -U /mnt >> /mnt/etc/fstab
Chroot
arch-chroot /mnt
Localization
- Hardware clock:
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
hwclock --systohc
- Set locale and input method:
vim /etc/locale.gen
- # en_US.UTF-8 UTF-8
+ en_US.UTF-8 UTF-8
locale-gen
echo LANG=en_US.UTF-8 >> /etc/locale.conf
echo KEYMAP=jp106 >> /etc/vconsole.conf
Hostname and hosts
- Hostname:
vim /etc/hostname
+ arch
- Hosts:
vim /etc/hosts
+ 127.0.0.1 localhost
+ ::1 localhost
+ 127.0.1.1 arch.localdomain arch
Root password
- passwd
passwd
Install necessary softwares
- Bootloader:
pacman -S grub efibootmgr os-prober
- Network and wireless tools:
pacman -S networkmanager network-manager-applet wireless_tools wpa_supplicant dialog
- Disk:
pacman -S mtools dosgstools
- Basic apps (bison, make, gcc, sudo, and etc.):
pacman -S base-devel
- Kernel header files:
pacman -S linux-headers
- Bluetooth and audio:
pacman -S bluez bluez-utils alsa-utils pulseaudio pulseaudio-bluetooth
- Desktop:
pacman -S xdg-utils xdg-user-dirs
- Git:
pacman -S git
- cron:
pacman -S cron
- reflector:
pacman -S reflector
- snapper:
pacman -S snapper
- Keyring:
sudo pacman -S archlinux-keyring
mkinitcpio
vim /etc/mkinitcpio.conf
- MODULES=()
+ MODULES=(btrfs)
mkinitcpio -p linux
Grub install
- Grub install and make config:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
Systemd
- Activate network:
systemctl enable NetworkManager
- Bluetooth:
systemctl enable bluetooth
- Refresh mirrorlist with reflector
- Exec options :
/etc/xdg/reflector/reflector.conf
- Weekly setting :
/usr/lib/systemd/system/reflector.timer
- Exec options :
systemctl enable reflector.service # update mirrorlist every boot
# or
systemctl enable reflector.timer # update mirrorlist weekly
Add user
- Add user:
useradd -mG wheel mori
passwd mori
- Give the user priviledge:
EDITOR=vim visudo
- # %wheel ALL=(ALL) ALL
+ %wheel ALL=(ALL) ALL
Finish base installation
- Reboot
exit
umount -a
reboot
Install desktop environment
Install and configure snapper
sudo umount /.snapshots
sudo rm -r /.snapshots
sudo snapper -c root create-config /
sudo btrfs su delete /.snapshots
sudo mkdir /.snapshots
sudo mount -a
sudo chmod 750 /.snapshots
sudo vim /etc/snapper/configs/root
+ TIMELINE_LIMIT_HOURLY="5"
+ TIMELINE_LIMIT_DAILY="7"
+ TIMELINE_LIMIT_WEEKLY="0"
+ TIMELINE_LIMIT_MONTHLY="0"
+ TIMELINE_LIMIT_YEARLY="0"
sudo systemctl enable --now snapper-timeline.timer
sudo systemctl enable --now snapper-cleanup.timer
paru -S snap-pac-grub snapper-gui-git
sudo mkdir /etc/pacman.d/hooks
sudo vim /etc/pacman.d/hooks/50-bootbackup.hook
+ [Trigger]
+ Operation = Upgrade
+ Operation = Install
+ Operation = Remove
+ Type = Path
+ Target = boot/*
+
+ [Action]
+ Depends = rsync
+ Description = Backing up /boot...
+ When = PreTransaction
+ Exec = /usr/bin/rsync -a --delete /boot /.bootbackup
sudo pacman -S rsync
sudo chmod a+rx /.snapshots
sudo chown :mori /.snapshots