Skip to content

Instantly share code, notes, and snippets.

Last active February 2, 2024 09:42
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dante-robinson/fdc55726991d3f17e0dbef1701d343ef to your computer and use it in GitHub Desktop.
Save dante-robinson/fdc55726991d3f17e0dbef1701d343ef to your computer and use it in GitHub Desktop.
BTRFS, XFS and EXT4 Arch Linux Install Guide

Arch Linux Install Guide

Table of Contents

Formatting the Drive
BTRFS Subvolumes and Mounting
EXT4 Mounting
XFS Mounting
Mounting Boot and setting up FSTAB
Setting Timezone and Locales
Setting up localhost and hosts
Installing GPU Driver
Initramfs Setup
Creating the user
Enabling systemd Startups
Installing a Desktop
Extra Junk

You can find an easier to read version of this guide on my blog here -

Welcome to my personal Arch Linux Build Setup this is somewhat of a personal run through of how I have my main system setup but more of an install guide so let’s get started. I have been running Arch since 2018 and it was my first distro, after multiple wacky installs to get something working and messing stuff up and needing to reinstall. I have learned what I personally like along the way and and making a write up on that as well as some other ways to install I have personally run to give an understanding to anyone reading. I have since tried many other Distros over the years such as popOS, Mint, Ubuntu, Debian, Artix, MX, Fedora, Manjaro and Elementary. However I keep coming back to Arch for just the sheer amount of packages (AUR) and how easy it is to use (learning curve aside of course).

To make this guide less complex I have not added any encryption or LVM instructions if you are looking for that please check out this guide -

Formatting the Drive

First of all you should understand how Linux reads drives already if you run the command

ls /dev

you should look for the drive you want to install sata drives will be labeled Sd(x) and nvme drives will be labeled nvme0n(x) with the x being the number or letter of the drive usually sda or nvme0n1. If you have multiple drives this is easy to figure out to if your familiar with how partitions are labeled already you should tell which drive you need already if not run

cfdisk /dev/sd(x) or cfdisk /dev/nvme0n(x)

on the drive you think you need. You should see the size of the partitions listed if the size doesn’t match up to your drive size that you are looking to install on just quit and try the next drive until you find the one you need for me its nvme0np1 so I will run

cfdisk /dev/nvme0n1

I then delete all the partitions on the drive and over the free space I do New and I type 1G for my boot partition and then select Type and set it to EFI System. I then move down to the free space item again and select new and select the rest of my drive whatever the partition size it gives me after that just select write and then you can quit the program.

I don’t run a Swap Partition as I can always create a .swapfile later on off the root partition and resize it to my liking. However I prefer to not create swapfiles due to the fact that they are slow and really hammer on your drive. If you have really low amounts of ram like 2GB then you should look at making a swapfile but the likely fact is anyone running that low of ram is most likely running on a HDD not an SSD so swap will be even slower for them. Basically swap will allow you to use more ram by using space on the drive you assign in the case that you need it.

People also tend to like to create a separate partition for their /home folder, It can be annoying when installing applications and needing more storage on my root and having majority dedicated to /home so I don’t do it however if you do a /home partition some advantages are being able to move from Distro to Distro and just manual partition the installs to use that /home you already have so all your games and stuff are already there, and if your system becomes corrupt your data “should” be safe on the separate partition.

You can see the new partitions by running


if you have a SATA Drive you should see sda1 and sda2 for example. In my case I have nvme0n1p1 and nvme0n1p2 this is how linux lists partitions off drives pretty straight forward.

This is pretty simple to do we can encrypt our root partition by running

cryptsetup luksFormat /dev/nvme0n1p2

of course swap /dev/nvme0n1p2 out with where your drives partition is.

Now we need to put some file systems on the drives for the keep the order of the partitions in your head as you will need to remember which partition is for which FS. In this case I have my first partition set to be my boot directory so I’m going to format it to FAT32 by running

mkfs.fat -F32 /dev/nvme0n1p1

just change the nvme0n1p1 to whatever drive and partition you are using such as sda1. Next I format my last partition to BTRFS now this is just what I am running at the moment I used to run XFS but have switched over to this for snapshots. If your new I recommend running EXT4 while XFS does tend to be slightly faster in my use case some games like WoW didn't work on it so it’s best to just stick to EXT4 here so your not making separate partitions in EXT4 for some games lol. BTRFS doesn’t have this issue in my use so far. If you want to read more I have some links here for each.


EXT4 -


To format to BTRFS run

mkfs.btrfs /dev/nvme0n1p2

If your going to run XFS or EXT4 its pretty similar

mkfs.xfs /dev/nvme0n1p2


mkfs.ext4 /dev/nvme0n1p2

and that’s the partitions finished off if your running a similar setup to me If you made a separate partition for your /home directory just run the ame command on that partition unless your running BTRFS then format your home partition to something else like XFS or EXT4. If you created a swap partition you will need to run

mkswap /dev/nvme0n1p(x)
swapon /dev/nvme0n1p(x)

on your partition you want for swap most likely the x will be 3 in this case but your mileage may vary. If you are making a swapfile I will show you how to make that in my Arch Tweaks gist.

BTRFS Subvolumes and Mounting

Alright if your running btrfs then you will need to follow these steps before continuing to create your snapshots, if your running XFS or EXT4 skip this Section.

First I mount my btrfs partition by running

mount /dev/nvme0n1p2 /mnt

Now we can create the subvolumes on the /mnt directory by running

btrfs su cr /mnt/@
btrfs su cr /mnt/@var
btrfs su cr /mnt/@opt
btrfs su cr /mnt/@tmp
btrfs su cr /mnt/@snapshots

if you didn’t create a separate /home partition then run if you did make a separate partition I will get to you later on don’t worry about it for now.

btrfs su cr /mnt/@home

Then we can unmount the partition by running

umount /mnt

So basically su is short form for the subvol command and you can also use sub and the cr command is short form for create again pretty straight forward just saving some time.

The subvolumes meanings

@ - Root
@home - Home Directory
@var - Logs,some temp. files, caches etc.
@opt - Add-on packages
@tmp - Main temporary files location
@snapshots - snapper will store your BTRFS Snapshots here if not using snapper this partition is not needed

So now we need to mount the partition as subvolumes… you can do so by running these commands and we might as well setup the fstab while we are here.

mount -o noatime,commit=120,space_cache=v2,subvol=@ /dev/nvme0n1p2 /mnt

mkdir /mnt/{boot,home,var,opt,tmp,snapshots}

mount -o noatime,commit=120,space_cache=v2,subvol=@opt /dev/nvme0n1p2 /mnt/opt

mount -o noatime,commit=120,space_cache=v2,subvol=@tmp /dev/nvme0n1p2 /mnt/tmp

mount -o noatime,commit=120,space_cache=v2,subvol=@snapshots /dev/nvme0n1p2 /mnt/snapshots

mount -o subvol=@var /dev/nvme0n1p2 /mnt/var

and then again if you don’t have a /home partition then run this also

mount -o noatime,commit=120,space_cache=v2,subvol=@home /dev/nvme0n1p2 /mnt/home

you may need to change the /dev/nvme0n1 command to your specific partition if not using an NVME drive setup the same way I have mine.

Mount -o the -o just means options when using mount and these are the options we are using

Noatime – basically improves performance by not writing the time the file was last accessed

commit – the time in seconds it takes for the data to be synchronized to storage set at 120 seconds here so if you lose power or crash any data within the last 2 minutes will be probably be lost feel free to change this.

compress – by not listing compress this sets my compression to none. You can use whatever compression method you prefer, the better the compression method the less space files will take on the drive leaving more space for other things. However this will affect the drive as you can see in the benchmark here -
If you want to add compression just add ",compress=type" where type is the method you want for example lzo. Make sure you add the comma or the fstab won't work properly.

space_cache – I have this set to =v2 you can remove this if you if you prefer to use v1 which can be more stable the devs say but I have had any issues running v2. This just lets the kernel know where blocks of free space are on the disk to write data to when a file is created.

Subvol – just selects the subvolume

If you have a separate /home partition you can now mount that for EXT4 running

mount -o noatime,commit=120 /dev/nvme0n1p(x) /mnt/home

the options using the mount command are similar to BTRFS however you can also add barrier=0 if you would that will help performance however you may run into data loss in the case of a power loss if not the entire partition becoming corrupted so I left it out here if your on a laptop or a UPS maybe consider this. I will link to a section to read more about this feature in the next section.

And for XFS by running

mount /dev/nvme0n1p(x) /mnt/home

XFS has its own performance tweaks outside of the fstab I link to more info about at the end of the guide.

EXT4 Mounting

You will need to mount your partitions to the /mnt Directory by running

mount -o noatime,commit=120 /dev/nvme0n1p(x) /mnt

and if you have a separate /home directory also run

mkdir /mnt/home && mount -o noatime,commit=120 /dev/nvme0n1p(x) /mnt/home

You can run just mount with out -o (options) but it’s easier to apply the performance tweaks to the fstab while mounting now so that we don’t have to come back and change them later on.

Noatime – basically improves performance by not writing the time the file was last accessed

commit – the time in seconds it takes for the data to be synchronized to storage set at 120 seconds here so if you lose power or crash any data within the last 2 minutes will be probably be lost feel free to change this.

Barrier - you can also add barrier=0 if you would that will help performance however you may run into data loss in the case of a power loss if not the entire partition becoming corrupted so I left it out here if your on a laptop or on a UPS System maybe consider this. You can read more about this here

XFS Mounting

Very simple to mount partitions no extra options just run

mount /dev/nvme0n1p(x) /mnt

and if you have an separate /home partition also run

mkdir /mnt/home && mount /dev/nvme0n1p(x) /mnt/home

Mounting Boot and setting up FSTAB (ALL)

Alright now we just have to mount the boot partition we created earlier to /mnt we can do that by running

mkdir /mnt/boot && mount /dev/nvme0n1p1 /mnt/boot

for me its my first partition so it looks like this change yours accordingly of course. If you are running on an older EFI system that doesn’t support UEFI change /mnt/boot to /mnt/boot/efi

After that we can start to install the basics to the mounted system by running

pacstrap /mnt base base-devel nano

pacstrap is similar to pacman Arch’s default package manager and it just used in the install process to install packages to the mounted directory, you can also install more stuff besides base and base-devel however for this guide we are just going to keep things simple.

After that finishes we can generate the fstab file for our mounted system by running

genfstab -U /mnt >> /mnt/etc/fstab

genfstab is just a command to create a file that tells the kernel what partitions to mount and where -U basically just means to assign UUID Values to each.

If your running BTRFS you also want to run

nano /mnt/etc/fstab

and then you should see some sort of editor and you want to make sure there's not option that looks similar to this

/dev/nvme0n1p2 UUID=8ghj7n71-25k1-1h64-h592-ab7j285gsh42
LABEL=ROOT              /               btrfs rw,relatime,compress=lzo,ssd,space_cache=v2,subvolid=256,subvol=/@,subvol=@

you basically want to remove the entire entry.

Setting Timezone and Locales

Now we can move into the mounted system by running

arch-chroot /mnt

now we need to get our timezone which we can get a list of available timezones by running

timedatectl list-timezones

then just use your keyboard to move down till you find the timezone closest to you once your done that press Control + C and run this command using that timzone

ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

After that we can sync the clock by running

hwclock --systohc

Now let’s add a language for our system to use by running

nano /etc/locale.gen

once in the locale.gen file you will see a lot of lanaguages all you need to do is scroll down to your lanaguge in my case “en_US.UTF-8 UTF-8” and what your going to want to do is remove the # from the front of the line this is a comment and anything with a # in front of it will not be read, so we remove it so the language we want is read by the system. After that we do Control + X and then it will ask to save the buffer we just press Y then it should ask file name to write just press enter. Now run this command to use the locale files on the system


and then we want to set the default language by running

echo LANG=en_US.UTF-8 >> /etc/locale.conf

with whatever language you have in my case it looks like this. The echo command basically means insert this text into the file, you can also run nano /etc/locale.conf and add LANG=en_US.UTF-8 (or whatever language your using) if you would prefer to do it that way instead.

Setting up localhost and hosts

We are almost done a basic Arch Linux install now and just need to do a few more things for now we need to setup the hostname of the Computer and edit our hosts file to be able to properly connect to the Internet. We can set our host name using the echo command again or using nano on the file and adding your hostname there, this can be any name you want I just name mine host so the command looks like this

echo host >> /etc/hostname

now we can edit our hosts file to use our hostname by editing the file with nano by running

nano /etc/hosts

Inside the hosts file under where it says see hosts for details you want to input this       localhost
::1             localhost       myhostname.localdomain  myhostname

where “myhostname” is the hostname you set so in my case it would be host.localdomain host for the last line. After that’s done Control + X again press y to save and then enter to overwrite the file.Now we need to start install packages like the kernel itself and the bootloader we can install everything we need by running just this one command

pacman -Syyu grub efibootmgr linux linux-firmware linux-headers networkmanager wpa_supplicant network-manager-applet reflector git bluez blueman bluez-utils xdg-utils xdg-user-dirs cups dosfstools e2fsprogs lvm2 foomatic-db-engine foomatic-db

after that finishes if you are running BTRFS you need to also run

pacman -S grub-btrfs btrfs-progs

If your running XFS you need to also run this

pacman -S xfsprogs

Installing GPU Driver

First we need to configure the pacman configuration file by running

nano /etc/pacman.conf

Once inside scroll down to find the 2 lines saying

#Include = /etc/pacman.d/mirrorlist

and remove the # symbols in front of each line then press Control + X then enter to save and exit the file. Then run

pacman -Syyu

to refresh the mirrors. After that’s finished we can start to install our GPU Drivers run the commands specific to your GPU. For the Nvidia Driver I am using the Closed Source Nvidia driver instead of the Open Source one from nouveau as it runs games much better. I have linked a performance comparison as well if you are interested in looking but In my opinion its no where close to being worth running.

pacman -S mesa lib32-mesa xf86-video-intel vulkan-intel

pacman -S mesa lib32-mesa xf86-video-amdgpu vulkan-radeon lib32-vulkan-radeon libva-mesa-driver mesa-vdpau

pacman -S nvidia-dkms nvidia-settings nvidia-utils lib32-nvidia-utils

NOUVEAU (Open Source Nvidia)
pacman -S mesa xf86-video-nouveau

For the nvidia package I went with nvidia-dkms over nvidia you can change this if you would like but let me explain why you should consider running DKMS. The standard nvidia driver will work fine with the default linux kernel however if you switch to a realtime kernel and other kernel like zen may not work. So its better to have DKMS from the gecko, If you don’t ever plan on running that then just change to nvidia. You can read more about DKMS here - Now let me explain these commands a little bit for those that are new, pacman is your package manager similar to apt-get or dnf. -S basically means download and install these packages and -Syyu basically means to update all the repos upgrade any new app versions and download and install these packages you can also run -Syyu without listing any packages. You can also run -Sy to just update Repos and -R to remove packages that's a basic run through of pacman. Next we will install the microcode for the CPU so run the command below for your CPU

pacman -S intel-ucode

pacman -S amd-ucode

Initramfs Setup

Now we need to edit our initial ram disk by running

nano /etc/mkinitcpio.conf

in the 7th line where it says MODULES=() without a # infront of it your gonna want to add a few things here this is going to change depending on your GPU and FS that you chose.

To start adding modules all you need to do is type the module between the () and then have a space between each module I have listed the modules u may need below.

BTRFS – btrfs
Intel GPU - i915
AMD GPU – amdgpu
NVIDIA Driver – nvidia nvidia_modeset nvidia_uvm nvidia_drm
Nouveau Driver – nouveau
EXT4 - ext4
XFS - xfs

After this we need to reset up our kernels to use these modules by running

mkinitcpio -P

Next we will need to install a Bootloader for a System to load our OS. If you are installing Arch along side another OS you can use this command to be able to read those other Operating Systems.

pacman -S os-prober

After that we can continue installing our bootloader by running this command

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Arch

and then run

grub-mkconfig -o /boot/grub/grub.cfg

The first line is just used to install the GRUB Bootloader to the system, some people prefer SystemD-Boot however I find GRUB Easier to use and still use it in all my installs hence its being used here. The target is just saying to install a bootloader for the x86_64 Architecture type then the restis pretty straight forward. The config command is more useful and will be used to update your bootloader in the future if you add or remove kernels from your system to be able to see those boot options. If you have another OS along the arch install and installed os-prober you can run that now by running


and then run the grub-mkconfig command again exactly how its written above.

Creating the user

Pretty much at the end now finishing touches before we have a basic install, next up is setting the root account password we can do that by running


and then entering a password 2x then we will create a user by running

useradd -mG wheel username

and of course username being the username would would like, Note that this username must be all lowercase letters and may only consist of numbers, letters, underscores, digits, periods, @ and dashes. The name may not start with a dash. The "$" sign is allowed at the end of usernames. -mG the m means to create a new home directory for the user and the G means to add the user to the group specified in this case wheel. You can also delete users by running userdel -r username.

Now with our user created we need to add a passwd for the new user the command is similar to the way we added a password for root by just adding the username to the end like so

passwd username

After that we need to edit our sudoers file to allow users of the wheel group to use the sudo command. We can edit that file by running one of the 2 commands below

EDITOR=nano visudo


nano /etc/sudoers

the first option will prevent you from destroying your system if you make a mistake. You need to go down until you see the line

%wheel ALL=(ALL) ALL

and remove the comment in front of it in this case the # symbol make sure to leave the % or the system will break. Then we can do Control + X press y to save and then enter.

Enabling systemd Startups

Now we can enable systemd to auto start certain items on boot not everything is a systemd enabled item but keep the command in mind as you may need it to enable certain programs in the future. We will run the following commands

systemctl enable NetworkManager
systemctl enable bluetooth
systemctl enable org.cups.cupsd

This is going to enable internet bluetooth and printing services.

Installing a Desktop

Now we can move on to the final step and that's installing the Desktop Environment (DE), there's lots to chose from and Arch allows you to pretty much run any of them easily I will cover a few.I personally run XFCE as I like to keep my system lightweight and don’t care for many effects or built in softwares. Here are a few links to view some different DE’s.
LXQt -
Budgie -
Cinnamon -

To Install XFCE

pacman -S xfce4 lightdm-gtk-greeter-settings xorg
systemctl enable lightdm

Installing just lightdm-gtk-greeter-settings will automatically grab the dependencies lightdm and lightdm-gtk-greeter to save some typing ;)

To Install GNOME

pacman -S gnome gdm xorg
systemctl enable gdm

To Install KDE Plasma

pacman -S plasma sddm xorg
systemctl enable sddm

To Install LXQt

pacman -S lxqt lightdm lightdm-gtk-greeter xorg
systemctl enable lighdm

Would recommend switching to a QT/Webkit Greeter (on low end PCs) once getting an AUR Helper installed.

To Install Budgie

pacman -S budgie-desktop lightdm-gtk-greeter-settings xorg gnome-control-center gnome-terminal
systemctl enable lighdm

To Install Cinnamon

pacman -S cinnamon gnome-terminal lightdm-gtk-greeter-settings xorg
systemctl enable lighdm

To Install MATE

pacman -S mate mate-extra ttf-freefont lightdm-gtk-greeter-settings xorg gnome-terminal
systemctl enable lighdm

If you noticed each Desktop has a different systemctl enabled packaged these are called Display Managers, not all Managers support every single Environment. You can read about different Display Managers here -
You can also find different Display Environments other than those listed here by checking out this page -

After that you can type exit to leave the chroot and then run the command

umount -a

to unmount all partitions it should do this automatically on reboot anyways but always good to double check to not get corrupted or something, their may be some errors running that as not everything can be unmounted that fine you can then just run the command


and then GRUB Should load into your system! If something breaks or is not working the best way to work on your Arch System in the future is to keep a USB with an ISO on it doesn’t need to be the most up to date that way if your system breaks you can load the ISO on the USB and mount the partitions like we did in the beginning and then just arch-chroot mnt into your system and edit any files or remove/install anything you need to try and bootup your system successfully.

XFS Performance Tweaks -

Extra Junk

Personally I have tried LXQt in the past I like it but the UI is just not good enough for me to switch from XFCE Full time. I hope to change over in the future but the difference in ram usage is minimal like 100-150MB on my system compared to XFCE. I have switched over to SwayWM now which runs lighter than both and works well for my needs, I wouldn't recommend it for a novice but if you are interested you check it out here. For those that think “Ram is supposed to be used so it doesn’t matter” your right and I would rather my system resources going to the applications I use and not the Desktop.

You can find my Linux Performance Tweaks guide here - If your looking to add more Security to your system check my Security Guide here -


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment