
Archlinux minimal Install with btrfs
Arch Linux Installation Guide
Introduction
If you don’t know about Arch Linux, and willing to learn, then check this post,
In this guide I’ll be installing Arch Linux with BTRFS. And in a separate article I’ll show you the way to a minimal KDE plasma desktop along with some extended possibilities. If you’re reading this I can assume you are already familiar with archwiki - a great place to learn about Arch Linux!
Why Arch?
If you don’t have much idea about different distros, maybe you can read this article. Also you’ll find a lot of guys in YouTube for this purpose (to explain you why you need arch). If you’ve much free time to tinker with your system and you are in need of a full time job with no salary, welcome to the arena! I’ll highly recommend you to try Arch Linux.
From ArchWiki
- 1 General
- 1.1 What is Arch Linux?
- 1.2 Why would I not want to use Arch?
- 1.3 Why would I want to use Arch?
- 1.4 What architectures does Arch support?
- 1.5 Does Arch follow the Linux Foundation’s Filesystem Hierarchy Standard (FHS)?
- 1.6 I am a complete GNU/Linux beginner. Should I use Arch?
- 1.7 Is Arch designed to be used as a server? A desktop? A workstation?
- 1.8 I really like Arch, except the development team needs to implement feature X
- 1.9 When will the new release be made available?
- 1.10 Is Arch Linux a stable distribution? Will I get frequent breakage?
- 1.11 Arch needs more press (i.e. advertisement)
- 1.12 Arch needs more developers
- 2 Installation
- 3 System maintenance
- 4 Package management
- 4.1 I have found an error with package X. What should I do?
- 4.2 Arch packages need to use a unique naming convention. “.pkg.tar.zst” is too long and/or confusing
- 4.3 Pacman needs a library so other applications can easily access package information
- 4.4 Pacman needs feature X!
- 4.5 I just installed Package X. How do I start it?
- 4.6 Why is there only a single version of each shared library in the official repositories?
- 4.7 What if I run a full system upgrade and there will be an update for a shared library, but not for the applications that depend on it?
- 4.8 Is it possible that there is a major kernel update in the repository, and that some of the driver packages have not been updated?
- 4.9 What to do before upgrading?
- 4.10 A package update was released, but pacman says the system is up to date
- 4.11 Upstream project X has released a new version. How long will it take for the Arch package to update to that new version?
- 4.12 If I need an older version of an installed library, can I just symlink to the newer version?
- 5 64-bit
Why BTRFS?
You might be familiar with computer storage formats like ntfs, fat32 or exfat. Btrfs (B-tree Filesystem, nicknamed Butter FS) is a modern filesystem built around the copy-on-write principle.
Snapshots
As Arch Linux is a rolling model, often called bleeding edge, system will be updated a lot and a lot of things can break or repair on each update.
With btrfs you can take snapshots within seconds and it’ll use less resource due to it’s copy-on-write principle. And what’s more you can also recover to a previous snap within a few seconds (just a simple restart),
Boot from snapshots
And the most interesting thing is that you can add your btrfs snapshot entry to GRUB bootloader. You can use pacman hook to trigger snapshot backup before any system update and an another script to add those backup as GRUB entry.
So if something goes wrong, you can go to previous condition right from your bootloader! I’ll show the way to achieve this on the next part (post installation).
Compression
BTRFS can compress your data as you write to save storage and it’ll be helpful on the long road. Also there are some cons. Read more here.
If you want to learn more about BTRFS then maybe a search through the web or, our favourite arch wiki is here,
Prerequisite
To install Arch Linux, indeed the best way to learn is Arch Wiki. But, the official guide will be little tough to understand to follow especially if you want to install on a btrfs file system or maybe a different kernel. This is why I won’t be explaining everything in details and my guide is specifically for intermediate users.
If your intention is blindly copy paste commands from this guide or Arch wiki without understanding anything, things may not work the way you want. So I highly recommend you to install any other distro. You can try,
- Manjaro Linux - for complete newbies to learn things around and recommended for stability.
- EndeavourOS - it’s more like graphical arch installer and highly recommended!
And keep these things in mind,
- Avoid blindly following online tutorials and instructions.
- Avoid installing unnecessary packages.
- Avoid assuming that commands will work without understanding what they do.
- Avoid partitioning without understanding the implications.
- Avoid using the root user for regular activities.
- Avoid using AUR packages without understanding the risks.
- Avoid using unsupported or experimental software.
- Avoid using the default kernel if it doesn’t provide the features you need.
- Avoid assuming that the installation will be successful without testing.
- Avoid reinstalling the system without backing up your data first.
Pre-Installation
ISO
You can grab it from official download page. To achieve better download speed you can try a local mirror. Scroll down a bit in the download page.
For example, my country is Bangladesh and I’ve a mirror available. I can achieve better broadband speed from this mirror!
It’s always recommended to select the latest version. File name is like,
- archlinux-2022.12.01-x86_64.iso
If you want, you can also try third party builds of ArchLinux. Check the following link,
Installation medium
You can use a USB flash drive or, an optical disc or a network with PXE for installation. Now USB drives are more better choice and I’ll recommend you to try ventoy available for almost every desktop platform. Take a backup of your drives data first and then launch ventoy. You can install ventoy on a drive, and later just copy the ISO to your drive. Specialty of ventoy is that you can put multiple ISO to make a multi-boot bootable USB and what’s more, you can also store data (anything) on that USB.
[OPTIONAL] You can also verify your ISO. Try this guide for that purpose,
Booting into live ISO
First, go to bios/ uefi setting. Different motherboard has different keybindings. You can search through web to learn more. Finally you have to point your first boot to the bootable USB or disk.
Extended guide in Arch Wiki,
Preparation
As for preparation, we’ll make sure we have an active internet connection and set our keyboard’s layout and time zone [optional]. I’ll install minimal KDE plasma desktop and I can manage my time zone and keyboard’s layout later using GUI. If you’re using a different layout than English, you may want to check,
Internet
If you’re using Ethernet cable, internet connection should work out of the box. As for WiFi users, connect using iwctl. And for mobile broadband users, try with the mmcli utility.
Now, test you connection with ping,
|
|
Tip: Ctrl + c to stop a process
Summary,
| utility | achievement |
|---|---|
| iwctl | WiFi |
| mmcli | mobile broadband |
| ping | check/ verify network |
Remote Installation (SSH)
If you want to let your friend install Arch on your PC, he can easily do it securely if both if your’re under the same local network,
Start SSH
|
|
Set a password for root,
|
|
Find the IP Address
|
|
From your other computer, connect via SSH (You’ll be prompted for the root password you just set)
|
|
Remote Installation (Internet)
But if your friend is on the other part of the planet or not on the same network, you can use internet protocol for this.
First, sync your packages and install tmate,
|
|
And, run, tmate and give your friend the access key!
If you get any error, first sync with,
pacman -Syand then install archlinux-keyring with,
pacman -S archlinux-keyringlater you can update archinstall,
pacman -S tmate
ArchInstall
Since 2021-04-01, Arch has a guided installer again. See archinstall for details. You can easily install Arch with the help of this script and avoid the rest of this post but if you want to extend your possibilities and configure everything with your own hand then I’ll recommend the manual way.
For easily install, first get the latest package,
|
|
Then run,
|
|
If you get any error, first sync with,
pacman -Syand then install archlinux-keyring with,
pacman -S archlinux-keyringlater you can update archinstall,
pacman -S archinstall
archinstall, then I would highly recommend you to install EndeavourOS. And if you want to install arch to show up, then while installing endeavouros select the online method and from the package choice list deselect endevouros corresponding packages and cofigs! Then it’ll install pure arch! Besides you’ll find arch GUI installers in the sourceforge.Partitioning
You can list you drives along with partitions using lsblk or fdisk -l. You may find something like, sda, sdb, etc. Here sda and sdb are two different drive/ disk. You’ll also notice their partitions (if they exist). If you need to change a partition table or create or remove or resize partitions there are several tools. I’ll recommend to use cfdisk. And to check disks and partitions size, try df -H.
Summary,
| command | achievement |
|---|---|
| lsblk | list drives along with existing partitions |
| fdisk -l | same as above with more information |
| df -H | list partitions size |
| cfdisk | manage partitions |
| parted | third party to manage partitions (Gparted CLI) |
Layouts
It’s recommended to get a basic concepts of disk partitions at first. Try the following post for understanding,
Checking UEFI/ BIOS
To verify the boot mode, list the efivars directory:
|
|
If the command shows the directory without error, then the system is booted in UEFI mode. If the directory does not exist, the system may be booted in BIOS (or CSM) mode. If the system did not boot in the mode you desired, refer to your motherboard’s manual.
BIOS with MBR
Check this link for an example layout,
- Partitioning - Legacy BIOS - ArchWiki For installation instruction on BIOS, please check this article,
- Arch Linux Installation Process for a Legacy/BIOS/MBR System #arch-linux · GitHub Also YouTube has quite a few full tutorials available!
UEFI
Most of the modern system supports UEFI (even BIOS can have it! Please check your BIOS first) and so I’ll continue my guide in UEFI only. You can go with the layout from Arch Wiki,
Our layout
Instead of creating a rigid, separate ext4 partition for /home and a dedicated swap partition, we will use a clean 2-partition scheme with a unified Btrfs storage pool. With Btrfs, subvolumes (such as @ for root and @home for user directories) dynamically share the same free space across the pool. There’s no need to guess ahead of time how many gigabytes / or /home will need—both grow and shrink dynamically as files are created and removed!
For swap, we will set up a flexible Btrfs swapfile in the post-installation part (part 2) rather than locking up storage in a fixed partition.
We standardize our EFI system partition mount point to /boot (FAT32, at least 512 MiB–1 GiB).
Layout, (let our disk be sda)
| Mount Point | Partition | Suggested Size | Partition Type | Filesystem |
|---|---|---|---|---|
/boot |
sda1 |
512 MiB – 1 GiB | EFI system partition | FAT32 |
| Btrfs Pool | sda2 |
Remaining space | Linux filesystem | Btrfs |
| Data / Windows | sda3 |
Optional | NTFS / ExFAT | NTFS |
We have an extra partition, right? We’ll think about it later! So whatever we do won’t affect this one. Think of it as a data partition.
Why a unified Btrfs pool instead of separate partitions?
- Btrfs subvolumes act like self-contained filesystems inside a single partition. Since
@and@homeshare remaining disk space dynamically, you never run into situations where your root partition runs out of space while your/homepartition sits mostly empty.
Why no swap partition?
- Dedicated swap partitions waste disk space if you don’t need them constantly. Modern Btrfs supports swapfiles cleanly, or you can use
zram-generator(RAM compression). We will create and configure a swapfile in the post-installation guide.
Formatting partitions
For the EFI partition (/boot), format it as FAT32 (make sure you don’t accidentally reformat an existing EFI partition if you are dual-booting with Windows!):
|
|
For our main Btrfs storage pool partition:
|
|
After formatting, you can label your partitions for easily identifying them later. For example:
|
|
Mounting partitions & Btrfs Subvolumes
Btrfs Subvolume Layout
We create subvolumes to organize our data, enable instant snapshots, and cleanly separate dynamic or cache directories from system rollbacks.
We standardize on the official 5-subvolume layout used by archinstall:
@->/(Root filesystem)@home->/home(User personal files & configs)@pkg->/var/cache/pacman/pkg(Pacman package download cache)@log->/var/log(System and journal logs)@snapshots->/.snapshots(Btrfs root snapshot store)
@var subvolume or separate /var/lib/pacman into its own subvolume! The package database in /var/lib/pacman must stay inside the root @ subvolume. If /var/lib/pacman is isolated, rolling back your root filesystem snapshot will cause the installed binaries on / and the pacman package database to become desynchronized, leading to broken dependencies and system corruption.Creating Subvolumes
Let’s mount the Btrfs partition to /mnt temporarily:
|
|
Now create the 5 subvolumes:
|
|
You can view all the subvolumes you created using:
|
|
Unmount /mnt:
|
|
Mounting Subvolumes & Partitions
Now we remount the root subvolume (@) with safe, modern mount options:
|
|
Create the directory mount points:
|
|
Mount the remaining subvolumes and EFI partition:
|
|
| Option | Meaning |
|---|---|
| noatime | Disables access time updates on files when read. Greatly improves I/O performance and SSD life. |
| compress | Enables transparent compression (zstd). Saves significant disk space and improves read speeds. |
| subvol | Specifies which Btrfs subvolume to mount at the target mount point. |
Selecting mirror
By default in the live boot, arch will generate mirrors in your mirrorlist file. You can achieve better download speeds by sorting fast local mirrors using reflector.
Reflector
With reflector you can easily update your mirrorlist:
|
|
Manually
You can also use a text editor to edit /etc/pacman.d/mirrorlist directly:
|
|
archlinux-keyring
To prevent invalid or corrupted package signature errors during installation, ensure the keyring is up to date:
|
|
Essential packages
Use the pacstrap(8) script with -K (to initialize an empty pacman keyring in the target system) to install the base system, kernel, development tools, Btrfs utilities, and networking:
|
|
Note on Kernels: We are installing
linux-zenfor optimized desktop performance. If you prefer the standard upstream kernel or the long-term stable kernel, simply replacelinux-zenwithlinuxorlinux-lts.
If you are using the linux-zen kernel, you can optionally install linux-zen-headers for building kernel modules (such as DKMS drivers, VirtualBox, or NVIDIA):
|
|
System configuration
fstab
Generate the fstab file using UUIDs so Arch knows where to mount your Btrfs subvolumes and EFI partition on boot:
|
|
entering chroot
Now change root into your new system!
|
|
chroot
This section covers essential configuration inside your new system.
root password
To set the root password:
|
|
We’ll need this password to log in on first boot, so make sure to remember it!
network
Enable NetworkManager so network services start automatically on boot:
|
|
host-name
Set your system hostname:
|
|
Enter your desired machine name (e.g. archlinux) and save.
hosts
Configure /etc/hosts:
|
|
Append the standard local loopback entries:
|
|
Replace
myhostnamewith the actual hostname you configured above.
Microcode
Install processor microcode updates:
- For AMD CPUs:
1pacman -S amd-ucode - For Intel CPUs:
1pacman -S intel-ucode
Bootloader
Install GRUB and EFI boot manager utilities:
|
|
Install GRUB to the /boot EFI directory:
|
|
Then generate the GRUB configuration file:
|
|
Localization
Edit /etc/locale.gen:
|
|
Un-comment your locale (for instance, remove the # before en_US.UTF-8 UTF-8). Save and exit (Ctrl+O, Enter, Ctrl+X in nano).
Generate the locales:
|
|
Set the system locale in /etc/locale.conf:
|
|
Additional steps
Timezone & Hardware Clock
Set your local timezone and synchronize the hardware clock to prevent clock desynchronization on first boot:
|
|
Substitute
Asia/Dhakawith your region/city (see available zones in/usr/share/zoneinfo/).
You can also check the ArchWiki for further initramfs or console customization:
- Initramfs [OPTIONAL]
Wrapping up
Reboot
Leave the chroot environment:
|
|
Unmount all partitions and reboot into your new Arch Linux system:
|
|
What to expect on first boot
After rebooting, select Arch Linux in the GRUB menu. You’ll arrive at a terminal login prompt:
- Log in as
rootusing the password you set during installation. - For connecting to Wi-Fi via terminal, use the interactive NetworkManager TUI tool:
Select Activate a connection, choose your Wi-Fi SSID, enter the password, and you’re online!
1nmtui
Stuck in GRUB? If you ever find yourself in the
grub-rescueshell, see below.
Grub rescue?
If you ever encounter the grub rescue shell (e.g. if grub-mkconfig was missed):
1. ls
List all available partitions and devices:
|
|
2. set
Inspect current Grub environment variables:
|
|
3. set prefix
Set the prefix pointing to your GRUB directory (since /boot is mounted on partition 1):
|
|
4. set root
Set the root partition to the boot partition:
|
|
5. insmod
Load the normal boot module:
|
|
6. normal
Launch the standard menu:
|
|
7. boot
Boot the system:
|
|
References
- Installation guide - ArchWiki
- Btrfs - ArchWiki
- How to Install Arch Linux | It’sFOSS
- Installing Arch Linux with a BTRFS filesystem | ArcoLinuxD
What’s next?
Now you can install your choice of desktop environment or window manager! Follow along in the next post for setting up minimal KDE Plasma and automated Btrfs snapshot boot support: