In this post I’m going to cover how to install arch Linux with BTRFS. Additionally, I’m going to go beyond the basic installation of Arch and I’m going to cover getting a fully functional Arch installation with KDE Plasma as well. This setup is my basic setup for most computers that I install Arch on. If you aren’t sure if Linux is right for you, you can check out my last article as well, which might help you decide.
How to install Arch Linux with BTRFS (overview)
- Create and boot the Arch Installation CD
- Prepare the disk
- Format as BTRFS and Mount
- Create and Mount BTRFS Subvolumes
- Install Arch Linux base system
- Configure the Arch system
- Install Graphical System
- Install a Bootloader
Table of Contents
Create and Boot the Arch Linux install disk
Download the Arch Linux ISO.
Head over to https://archlinux.org/download/ and download the ISO either using the torrent/magnet link, or scroll down to find that ‘direct download‘ that seems like it’s the closest to your physical location.
Flash the ISO to a USB drive.
Boot from the USB on the computer.
Insert the freshly flashed USB drive into the computer that you plan on installing Arch with BTRFS on. Power on the computer, and use the appropriate key to open the boot menu and choose the USB drive. This varies for each motherboard but it is usually one of the higher function keys like F11 or F12.
Alternatively you can set the USB is the first boot device in your BIOS.
After booting off of the USB, you should be presented with the boot menu of the USB drive and it should look like this.
If it looks different (all black and white without a logo) you have booted using UEFI. This guide will not be covering an EFI install. The installation process is mostly the same, however the partitioning and bootloader sections will be slightly different. If you are at least a little bit comfortable with installing Arch, you may still be able to figure it out. Otherwise, go back to the first step and re-flash using the appropriate settings to boot into BIOS mode instead.
Prepare the Disk.
Now that we have booted into the Arch live environment, we can now get the disk ready to set up BTRFS and install Arch.
Find the name of your install disk.
lsblk command to find out the disks that are available on the system. They will often be called
sd<letter> if it’s a SATA disk, or
nvme<number> if it’s an NVMe disk.
You can see in my command output that the disk I’m looking for is sda, yours my be different. If it is, replace any future references to sda or /dev/sda in this guide with whatever your disk is called.
Create the root partition.
cfdisk to create the one and only partition we will make on this disk. The partition will be of type
8300 (Linux) and it will be the entire size of the disk. We will later use BTRFS to create the segmented partitions that you may be familiar with.
WARNING: You will be wiping all data on the chosen hard drive. It’s important that you make backups of any data, and be sure that you are aware and prepared to lose everything.
When cfdisk opens, choose the
cfdisk is open, there should only be one line with label “Free Space”, otherwise select each line using the up and down arrows, and choose delete with the left and right arrow keys until your screen looks like this.
new by using the left and right arrow keys and hit enter. Hit enter two more times to create a new partition. It will automatically be given the appropriate partition type.
Use the arrow keys to go over and choose write. After hitting enter on write you will need to type the word
yes to confirm that you will be destroying all data on the selected drive.
Afterwards use the arrow keys to move over to the quit option and hit enter.
Format the partition.
Now that the partition is created, we need to format it as BTRFS. We will use the command
mkfs.btrfs -L "Arch" /dev/sda1
Mount the BTRFS partition.
Now we need to create a directory, and mount the newly formatted partition.
mkdir /mnt/btrfs-root mount -o defaults,relatime,discard,ssd,nodev,nosuid /dev/sda1 /mnt/btrfs
Create and mount the BTRFS subvolumes.
Subvolumes of BTRFS are probably the main reason people want to learn how to install Arch Linux with BTRFS. Subvolumes work similar to physical partitions of the disk but have the advantage that they don’t need to have a defined size, and can also be created and modified on the fly. We will also be setting up BTRFS for using snapshots in the future which is another primary reason for BTRFS.
Create the BTRFS subvolumes.
We need to create two directories under the mounted BTRFS partition. One will be
_current which will contain all of our current running files, and a
_snapshot directory that will house any snapshots that we take in the future.
mkdir -p /mnt/btrfs-root/__snapshot mkdir -p /mnt/btrfs-root/__current
After we make the directories, we’ll create the root and home subvolumes.
btrfs subvolume create /mnt/btrfs-root/__current/root btrfs subvolume create /mnt/btrfs-root/__current/home
Mount the BTRFS subvolumes.
The last thing we need to do before we can actually start installing Arch Linux is to mount the new subvolumes.
mkdir -p /mnt/btrfs-current mount -o defaults,relatime,discard,ssd,nodev,subvol=__current/root /dev/sda1 /mnt/btrfs-current mkdir -p /mnt/btrfs-current/home mount -o defaults,relatime,discard,ssd,nodev,nosuid,subvol=__current/home /dev/sda1 /mnt/btrfs-current/home
Install Arch Linux
The disk is all prepared, and now we can move forward to installing and configuring Arch.
Install the base Arch System.
The Arch live CD makes it easy to install arch with BTRFS because pacstrap actually installs the entire base system in one single command.
pacstrap /mnt/btrfs-current base base-devel
chroot into the new installation.
pacstrap has installed the base system, we can
chroot into it and start configuring our system. We use
arch-chroot to get into the system.
arch-chroot /mnt/btrfs-current /bin/bash
Install btrfs software.
Now that we’re chrooted into the new system, we’re gonna need to install the
linux packages. These packages contain all of the software we need to interact with our btrfs filesystem as well as generate a new inital ramdisk to load in btrfs.
pacman -S btrfs-progs mkinitcpio linux
Configure the Arch system
At this point, you’ve already learned how to install Arch Linux with btrfs, but in all reality this isn’t a usable system yet. As a matter of fact it won’t even boot, so we have to do some configuration first.
Set the system locale.
Now we need to set up the systems locale. Use
vim or whichever editor you prefer (try
nano if you’re new) and edit the
Note: If your editor of choice isn’t installed, install it with
pacman -S <editor> (ex.
pacman -S nano)
That chooses the locale we want, and then we will generate the locale by using
locale-gen. Afterwards we’ll set up the
locale.conf file and export it to the shell.
locale-gen echo LANG=en_US.UTF-8 > /etc/locale.conf export LANG=en_US.UTF-8
Set the system timezone.
Next up we need to set our timezone, which is as easy as creating a symlink. I live in US Central, so I am going to choose America/Chicago. There is a list of the available timezones here otherwise you can use the command
timedatectl list-timezones to list the available timezones. Once you find the appropriate time zone, remember it and press the “q” key to exit the list.
Set the timezone by creating a symlink from your timezone to the
# Make sure you do /usr/share/zoneinfo/ ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
Set the hostname.
Our next step is to set the hostname for our Arch installation. Hostnames can be from 1 to 63 characters long, and the allowed characters are a-z, A-Z, 0-9, and -. We will just write our hostname into the
echo 'my-arch-system' > /etc/hostname
Configure the initial ramdisk.
The ramdisk is a bit out of scope for this guide, but you can read more about it here and here. What it basically is though, is everything that needs to be loaded into RAM for the Linux environment to get started.
Because we are running btrfs, we have a change that we need to make to the initial ramdisk. Edit the
/etc/mkinitcpio.conf file. Find the
HOOKS and remove fsck, and add btrfs.
We’ve made the configuration change, now we just need to generate the ramdisk with
mkinitcpio -p linux
Create a non root user.
You shouldn’t be using the root user, really ever, so let’s make ourselves a normal user. Use the command
useradd to create a new user, and set the password for the new user.
# replace daniel with your desired username useradd -m -s /bin/bash daniel passwod daniel
Give the new user sudo privileges.
sudo allows regular users to perform actions as root when needed. We can add sudo privileges by add the user to the
wheel group with the
usermod command, and enabling it in the
sudoers file. We edit the
sudoers file with the command
visudo. By default
visudo will automatically use vim however, you can change the editor by prefixing the command with
# make sure you replace `daniel` with your username usermod -aG wheel daniel visudo
Install a graphical system.
We’ve got a barebones system all set up now. The next thing we need is a graphical system. I love KDE Plasma but there a ton of options out there. A quick Google search will certainly get you a guide on how to install any other sort of system.
Install the necessary packages.
As you would expect, we need a few packages for this to work. We’re gonna install a graphical display manager (
sddm), the X window system (
xorg), KDE Plasma (
plasma), and the associated kde programs that are built for KDE (
pacman -S xorg plasma kde-applications sddm
It will ask about 6 questions, you can just hit enter to accept the defaults on every question. Depending on your internet connection and computer this could take a while. Of the desktop environments out there, KDE tends to on the heavier side. This tends to be the longest part of learning how to install Arch Linux with BTRFS because KDE is the heaviest part of the entire installation.
Enable SDDM display manager, and NetworkManager.
We need to enable the SDDM display manager on boot so that it can take over hand handle logins when the computer starts, as well as enable NetworkManager to handle the network on boot.
systemctl enable sddm # Notice the case on NetworkManager, it always gets me systemctl enable NetworkManager
Install the bootloader.
We’re almost there, this is the last step of the installation. We need to install the bootloader, which as you might have guessed, handles the system at boot.
Install the necessary packages.
There’s only one package to install, and that’s the bootloader itself
pacman -S grub-bios
Install grub to the MBR.
Now that the package is installed, we need to install grub onto the MBR of the disk using the
grub-install --target=i386-pc --recheck /dev/sda
Generate a grub configuration.
Now that Grub is installed to the MBR, we just need to generate a configuration for it, and it will be all set to go.
grub-mkconfig -o /boot/grub/grub.cfg
Clean up installation and reboot.
The installation is all complete at this point, so we need to get out of our chroot and unmount all the partitions. Then we will be able to reboot into our new system.
exit umount /mnt/btrfs-current/home umount /mnt/btrfs-current umount /mnt/btrfs-root reboot
Upon a reboot (assuming everything went well) you will be presented with the SDDM default login screen. From here you can use the user we created a bit ago and log into your new desktop.
Overall, learning how to install Arch Linux with BTRFS isn’t the most difficult task in the world, especially if you have even a little bit of experience with Linux in general. If you look back through the guide it’s actually not that many commands and the concepts are mostly pretty straightforward. BTRFS might be a little bit confusing to make sense of for some people but the documentation on the Arch Wiki is really great.
If you run into any issues, please don’t hesitate to get in touch with me. You can leave a comment here, or you can also hop into my Discord server where there are others that can help as well. Additionally you can contact me directly if you need to. My information is the the Contact page.
Thanks a ton for reading, I really hope it was helpful!