├── README.md └── files ├── arch-btrfs.conf ├── fstab ├── loader.conf ├── mkinitcpio.conf └── upgrade-system.sh /README.md: -------------------------------------------------------------------------------- 1 | # Arch installation on a BTRFS root filesystem 2 | This is a cheatsheet with all the instructions to perform an installation of Arch Linux using BTRFS filesystem in / 3 | 4 | Please, read **the entire document** before proceeding because it includes two different approaches. The key is to include /boot directory in the snapshots for root in order to be able to rollback the entire system without any problem it it is needed. Lets proceed! 5 | 6 | [TOC] 7 | 8 | ## Laptop model 9 | The installation has been done on a [Mountain Onyx](https://www.mountain.es/portatiles/onyx) laptop. 10 | 11 | - **Screen**: 15,6" Full HD IPS Mate 12 | - **CPU**: Intel® Core™ i7 6700HQ - 4C/8T 13 | - **RAM**: 8GB DDR3L 1600 SODIMM 14 | - **Hard Disk**: SSD 240GB M.2 550MB/s 15 | - **GPU**: Nvidia GTX 960M 2GB GDDR5 + Intel i915 (Skylake) 16 | - **UEFI** 17 | 18 | ## Approach 1 [UEFI, GPT and GRUB] 19 | I have been following [Official Arch Installation Guide](https://wiki.archlinux.org/index.php/Installation_guide). Arch ISO booted in UEFI mode using **systemd-boot**. It was configured a wired connection too. 20 | 21 | ### Partitioning 22 | This is the selected layout for the UEFI/GPT system: 23 | 24 | | Mount point | Partition | Partition type | FS Type | Bootable flag | Size | 25 | |-------------|-----------|---------------------|-----------|----|--------| 26 | | /boot/efi | /dev/sda1 | EFI System Partition| FAT32 | Yes | 512 MiB| 27 | | [SWAP] | /dev/sda2 | Linux swap | SWAP | No | 16 GiB | 28 | | / | /dev/sda3 | Linux | BTRFS | No | 222 GiB | 29 | 30 | After creating the partitions using [fdisk](https://wiki.archlinux.org/index.php/Fdisk), it was necessary to format them. Again, I followed the guide without a problem. 31 | 32 | **IMPORTANT**: I used **-L** option with *mkfs* command in order to create a label for **/** (called **arch**). 33 | 34 | ### BTRFS layout 35 | The only partition formated with BTRFS was /dev/sda3, which contains the whole root system. BTRFS was selected to enable snapshots support in order to avoid any possible problem with Arch updates. Sometimes, I have experimented that certain critical package updates can break the system. If it occurs, it is a good idea to have some snapshot to rollback the entire root filesystem. tmp snapshots never will be created, because all the files stored within tmp are temporal. This is the layout defined: 36 | 37 | ``` 38 | sda3 (Volume) 39 | | 40 | | 41 | - _active (Subvolume) 42 | | | 43 | | - rootvol (Subvolume - It will be the current /) 44 | | - homevol (Subvolume - it will be the current /home) 45 | | 46 | - _snapshots (Subvolume - It will contain all the snapshots which are subvolumes too) 47 | ``` 48 | And these are the commands: 49 | 50 | ``` 51 | mkfs.btrfs -L arch /dev/sda3 52 | mount /dev/sda3 /mnt 53 | cd /mnt 54 | btrfs subvolume create _active 55 | btrfs subvolume create _active/rootvol 56 | btrfs subvolume create _active/homevol 57 | btrfs subvolume create _snapshots 58 | ``` 59 | 60 | Next, create all the directories needed and mount all the partitions (/boot/efi included) in order to start the installation: 61 | 62 | ``` 63 | cd .. 64 | umount /mnt 65 | mount -o subvol=_active/rootvol /dev/sda3 /mnt 66 | mkdir /mnt/{home,boot} 67 | mkdir /mnt/boot/efi 68 | mkdir /mnt/mnt/defvol 69 | mount /dev/sda1 /mnt/boot/efi 70 | mount -o subvol=_active/homevol /dev/sda3 /mnt/home 71 | mount -o subvol=/ /dev/sda3 /mnt/mnt/defvol 72 | ``` 73 | 74 | ### Installing Arch Linux 75 | Proceed with the installation according to the official guide. 76 | 77 | ### Fstab 78 | After executing *genfstab -U /mnt >> /mnt/etc/fstab* to generate fstab file using **UUIDs** for the partitions, I edited fstab in order to remove completely **subvolids** for example (they are not needed and it makes rollback much more easy) and adding compression to BTRFS mounted points and this is the result. Please, be aware of **/mnt/defvol** mounting point. This directory is very important because the WHOLE BTRFS volume will be mounted here and you will have access to all subvolumes and snapshots created after the installation) 79 | 80 | ``` 81 | # /dev/sda3 LABEL=arch 82 | UUID=9882a07e-0a0c-419d-bbdd-cbfbc4a6ffc9 / btrfs rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvol=/_active/rootvol 0 0 83 | 84 | # /dev/sda1 85 | UUID=3074-C66B /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2 86 | 87 | # /dev/sda3 LABEL=arch 88 | UUID=9882a07e-0a0c-419d-bbdd-cbfbc4a6ffc9 /home btrfs rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvol=_active/homevol 0 0 89 | 90 | # /dev/sda2 91 | UUID=9943adc7-d8a5-4500-bb35-3179aca961f5 none swap defaults 0 0 92 | 93 | UUID=9882a07e-0a0c-419d-bbdd-cbfbc4a6ffc9 /mnt/defvol btrfs rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvol=/ 0 0 94 | ``` 95 | 96 | ### Mkinitcpio 97 | In order to enable BTRFS on initramfs image, I added **btrfs** on HOOK inside **/etc/mkinitcpio.conf**. Then, it was necessary to execute **mkinitcpio -p linux** again. If you install linux-lts kernel (Long Term Support), you will have to execute **mkinitcpio -p linux-lts** 98 | 99 | ### Microcode 100 | I installed **intel-ucode** package because I have an Intel CPU. 101 | 102 | ### Bootloader 103 | If you want to have BTRFS snapshots integrated from booting you will have to install GRUB. Thanks to [grub-btrfs](https://www.archlinux.org/packages/community/any/grub-btrfs/) package, you will be able to boot your system directly from any snapshot of ROOT created. All these snapshots will be populated in the GRUB menu. 104 | 105 | GRUB is totally compatible with EFI systems. Install **grub** and **efibootmgr**: 106 | 107 | pacman -S grub efibootmgr 108 | 109 | Install the GRUB EFI application executing this command (please, choose the directory where EFI application will be stored, in my case **/boot/efi**, the partition created before): 110 | 111 | grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB 112 | 113 | Generate the main **grub.cfg** configuration file: 114 | 115 | grub-mkconfig -o /boot/grub/grub.cfg 116 | 117 | ### Additional packages installed 118 | A bunch of useful packages has been installed too: [tlp](https://wiki.archlinux.org/index.php/TLP) for energy saving and advanced power management, [reflector](https://wiki.archlinux.org/index.php/Reflector) for optimizing Arch mirrors repositories, [yay](https://newbloghosting.com/how-to-install-yay-on-arch-linux/) for compiling and installing packages easily from AUR repository, [snapd](https://wiki.archlinux.org/index.php/Snapd) to install snap packages, [btrfs-progs](https://wiki.archlinux.org/index.php/Btrfs) to manage BTRFS filesystem. 119 | 120 | ### Finish the steps in the Wiki 121 | And reboot!! 122 | 123 | ### Automated snapshots and system updates 124 | Recently I have developed a graphical tool for creating BTRFS snapshots, balancing filesystems and upgrading the system safetly. It works in **Arch Linux** and **Debian**, **Ubuntu** or derivatives. For more information, please [check ButterManager](https://github.com/egara/buttermanager). Please, read [the documentation](https://github.com/egara/buttermanager) in order to configure it before the first use. 125 | 126 | If you prefer another option, I have also created a very simple script called **upgrade-system.sh**. You can store it within **/usr/bin/upgrade-system.sh** and it can be invoked for performing system upgrades. Before starting the installation of the packages updated, the script creates a new snapshot. Then, pacman, yay and snapd are launched to upgrade the system. If something went wrong, you can restore the root filesystem using the last snapshot created. This script can be found [here](https://github.com/egara/arch-btrfs-installation/blob/master/files/upgrade-system.sh) 127 | 128 | ### Configuration files 129 | In this [folder](https://github.com/egara/arch-btrfs-installation/tree/master/files) you can find all the configuration files edited or created during the installation process. 130 | 131 | ## Approach 2 [BIOS,MBR and GRUB] ## 132 | First, it was necessary to disable UEFI mode and enabling legacy BIOS. Then, I partitioned the system using only two partitions: sda1 for / (including boot partition and home and sda2 for swap. I installed [GRUB as a boot loader](https://wiki.archlinux.org/index.php/GRUB#Master_Boot_Record_(MBR)_specific_instructions). 133 | 134 | ## Graphics and Optimus installation ## 135 | The laptop has two graphic cards: Integrated: **Intel i915** and discrete **NVIDIA GTX 960M**. Then, it is interesting to have optimus technology enabled and working fine. This way, NVIDIA graphics card will only be used when a game is executed, saving power and extending battery life. These are the steps followed to have this technology working on this hardware (it was a little tricky). 136 | 137 | ++Note:++ For a stable installation, it is recommended a LTS system instead of a cutting edge one. Because of this, I installed **linux-lts** and **linux-lts-headers** instead of normal kernel and **nvidia-lts** and **bbswitch-lts** from the repository. 138 | 139 | For the graphics cards installation and Optimius: 140 | 141 | - Install video graphic drivers: [Intel](https://wiki.archlinux.org/index.php/intel_graphics#Installation) including vulkan support and [bumblebee with NVIDIA](https://wiki.archlinux.org/index.php/bumblebee#Installing_Bumblebee_with_Intel.2FNVIDIA) 142 | 143 | - Install [primus and lib32-primus](https://wiki.archlinux.org/index.php/bumblebee#Primusrun) 144 | - We will add three [kernel boot parameters in GRUB](https://wiki.archlinux.org/index.php/Kernel_parameters#GRUB). Edit **/etc/default/grub** and change **GRUB_CMDLINE_LINUX_DEFAULT**. The line should be like this (I have removed **quiet** in order to see all the details of the booting process and check that evrything is OK): 145 | 146 | GRUB_CMDLINE_LINUX_DEFAULT="i915.enable_rc6=0 pcie_port_pm=off acpi_osi=\"!Windows 2015\"" 147 | 148 | The three kernel boot parameters added are: 149 | 150 | - Kernel boot parameter for [Skylake i915 GPU](https://wiki.archlinux.org/index.php/intel_graphics#Skylake_support). 151 | - If you are using kernel 4.8 or higher, add kernel boot parameter **pcie_port_pm=off** as you can see [here](https://wiki.archlinux.org/index.php/NVIDIA/Troubleshooting#Modprobe_Error:_.22Could_not_insert_.27nvidia.27:_No_such_device.22_on_linux_.3E.3D4.8) for avoiding error **"Could not insert 'nvidia': No such device"** 152 | - Kernel boot parameter **acpi_osi=\"!Windows 2015\"** for avoiding the system freezes when we enable bumblebeed.service. 153 | 154 | Finally, execute **sudo grub-mkconfig -o /boot/grub/grub.cfg** in order to rebuild grub configuration with all these changes. 155 | 156 | - Add modules **intel_agp** and **i915** (intel_agp must go always before i915) as you can see [here](https://wiki.archlinux.org/index.php/intel_graphics#Blank_screen_during_boot.2C_when_.22Loading_modules.22) within [mkinitcpio.conf](https://wiki.archlinux.org/index.php/Kernel_mode_setting#Early_KMS_start) in order to enable KMS during the initramfs stage. This will avoid a black screen and will prevent the system to freeze. Rebuild initramfs using **mkinitcpio -p linux** or **mkinitcpio -p linux-lts** depending on the kernel you have installed. 157 | 158 | - Install **bbswitch** for graphic cards power management: **sudo pacman -S bbswitch** (if you are using linux-lts or custom kernel, **bbswitch-dkms** is recommended) 159 | 160 | - Finally, execute **lspci** and take note of the ID for the NVIDIA card (01:00.1 in my case for example). Edit this file **sudo nano /etc/bumblebee/xorg.conf.nvidia** and uncomment the line **BusID "PCI:01:00:0"** writing there the ID you obtained before. 161 | 162 | - For launching Steam games and use NVIDIA graphics card, open Steam --> Library --> right click on the game you want to launnch --> Set Launch Options -> Type: **optirun -b primus %command%** 163 | - For launching wine games and use NVIDIA graphics card, launch the game with **env WINEPREFIX="/home/egarcia/.wine" /usr/bin/optirun -b primus wine C:\\windows\\command\\start.exe /Unix /home/egarcia/.wine/dosdevices/c:/users/Public/Escritorio/Hearthstone.lnk**. Another method is, for example to execute **Battle.net** with wine, execute de exe file using **optirun -b primus wine "C:\Program Files (x86)\Battle.net\Battle.net.exe"** 164 | 165 | ### Resources ## 166 | [Antergos Wiki for Bumblebee, NVIDIA and Optimus](https://antergos.com/wiki/hardware/bumblebee-for-nvidia-optimus/) 167 | 168 | ## Bluetooth installation ## 169 | Normally, bluetooth chipset (intel/ibt-11-5.sfi) should work out of the box, but there is a problem loading **btusb** kernel module. In order to make it work, it is necessary to create a script in **/usr/bin** called **start-bluetooth.sh** with this content: 170 | 171 | ``` 172 | #!/bin/bash 173 | modprobe -r btusb 174 | modprobe btusb 175 | ``` 176 | 177 | ++Tip:++ If you want, you can create a desktop launcher and locate it within **~/.local/share/applications** with this content: 178 | 179 | ``` 180 | [Desktop Entry] 181 | Comment[en_US]= 182 | Comment= 183 | Exec=gksudo /usr/bin/start-bluetooth.sh 184 | GenericName[en_US]= 185 | GenericName= 186 | Icon=preferences-system-bluetooth 187 | MimeType= 188 | Name[en_US]=Bluetooth 189 | Name=Bluetooth 190 | Path= 191 | StartupNotify=true 192 | Terminal=false 193 | TerminalOptions= 194 | Type=Application 195 | X-DBUS-ServiceName= 196 | X-DBUS-StartupType= 197 | X-KDE-SubstituteUID=false 198 | X-KDE-Username= 199 | ``` 200 | 201 | ## Problem with Docker and BTRFS ## 202 | More than a problem is a caveat. If the main filesystem for root is BTRFS, docker will use BTRFS storage driver (Docker selects the storage driver automatically depending on the system's configuration when it is installed) to create and manage all the docker images, layers and volumes. It is ok, but there is a problem with snapshots. Because **/var/lib/docker** is created to store all this stuff in a BTRFS subvolume which is into root subvolume, all this data won't be included within the snapshots. In order to allow all this data be part of the snapshots, we can change the storage driver used by Docker. The preferred one is **overlay2** right now. Please, check out [this reference](https://docs.docker.com/engine/userguide/storagedriver/selectadriver/) in order to select the proper storage driver for you. You must know that depending on the filesystem you have for root, some of the storage drivers will not be allowed. 203 | 204 | For using overlay2: 205 | 206 | - [Install docker](https://wiki.archlinux.org/index.php/Docker) 207 | - Create a file called **storage-driver.conf** within **/etc/systemd/system/docker.service.d/**. If the directory doens't exist, create the directory first. 208 | 209 | ``` 210 | sudo mkdir -p /etc/systemd/system/docker.service.d/ 211 | sudo nano /etc/systemd/system/docker.service.d/storage-driver.conf 212 | ``` 213 | 214 | - This is the content of **storage-driver.conf** 215 | 216 | ``` 217 | [Service] 218 | ExecStart= 219 | ExecStart=/usr/bin/dockerd -H fd:// --storage-driver=overlay2 220 | ``` 221 | 222 | - Create **/var/lib/docker/** and disable CoW (copy on write for BTRFS): 223 | 224 | ``` 225 | sudo chattr +C /var/lib/docker 226 | ``` 227 | 228 | - Enable and start the service 229 | 230 | ``` 231 | sudo systemctl enable docker.service 232 | sudo systemctl start docker.service 233 | ``` 234 | 235 | - Add your user to docker group in order to use docker command without sudo superpowers! 236 | 237 | ## Pulseaudio high battery consuption 238 | Using **Energy Information** application provided by KDE Plasma, I realized that pulseaudio daemon was eating the energy of my battery in a very strange way. Then I realized that it was a bug described [here](https://bugs.launchpad.net/ubuntu/+source/linux/+bug/877560). To fix this bug, it is necessary to manually force power save for the audio codec: 239 | 240 | - Before proceeding, in a terminal launch the following command: 241 | 242 | cat /sys/module/snd_hda_intel/parameters/power_save* 243 | 244 | if the result is different from: 245 | 246 | 1 247 | Y 248 | 249 | then try the following commands 250 | 251 | echo 1 | sudo tee /sys/module/snd_hda_intel/parameters/power_save 252 | echo Y | sudo tee /sys/module/snd_hda_intel/parameters/power_save_controller 253 | pkill pulseaudio 254 | 255 | - Log out and log in again to get pulseaudio restarted. 256 | 257 | 258 | ## No sound over the headphones after suspending 259 | This laptop is a Clevo and there is a known issue about this model: after suspending, there is no sound over the headphones anymore. 260 | 261 | To solve this issue: 262 | 263 | yay -S init-headphones 264 | sudo systemctl start init-headphones 265 | sudo systemctl enable init-headphones 266 | 267 | After this, edit **/etc/default/grub** and add this flag to **GRUB_CMDLINE_LINUX_DEFAULT**: 268 | 269 | acpi_enforce_resources=lax 270 | 271 | Then, rebuild grub configuration: 272 | 273 | sudo grub-mkconfig -o /boot/grub/grub.cfg 274 | 275 | ## Restructuring BTRFS Layout on Antergos or another distribution 276 | 277 | - I have installed [Antergos](https://antergos.com/) (Arch-based distro easy to install and to go without too much configuration) on a PC (using BIOS legacy mode instead UEFI) that I needed to work inmediately. I used BTRFS too for the installation, but the problem is that you cannot choose the layout you want for your BTRFS volume. Instead, all the root system is installed directly in the top volume itself, but I want a more refined layout (the layout defined above) in order to manage all the snapshots in a more proper way. Because of that, I detailed all the steps I made in order to mmigrate my installation to a customize layout. 278 | Once the system is installed, reboot and open a terminal to see the structure of the BTRFS volume for /: 279 | 280 | ``` 281 | sudo btrfs subvolume list / 282 | cd / 283 | ``` 284 | 285 | Create all the subvolumes on / except rootvol subvolume: 286 | 287 | ``` 288 | sudo btrfs subvolume create _active 289 | sudo btrfs subvolume create _snapshots 290 | ``` 291 | 292 | Now, it is necessary to make a read-write snapshot of / into _active/rootvol 293 | 294 | ``` 295 | sudo btrfs subvolume snapshot / /_active/rootvol 296 | ``` 297 | 298 | Reboot the system using Archlinux LiveCD or Antergos LiveCD. 299 | Once the system is booted, mount all the structure within /mnt using as root /_active/rootvol (in my case, / is in /dev/sda1 and /home is in /dev/sdb2): 300 | 301 | ``` 302 | mount -o subvol=/_active/rootvol /dev/sda1 /mnt 303 | mount /dev/sdb2 /mnt/home 304 | 305 | ``` 306 | Chroot the new system: 307 | ``` 308 | arch-chroot /mnt /bin/bash 309 | ``` 310 | 311 | Add **btrfs** as HOOK within /etc/mkinitcpio.conf and rebuild images: 312 | 313 | ``` 314 | mkinitcpio -p linux 315 | ``` 316 | 317 | Create a new directory called **defvol** within /mnt 318 | 319 | ``` 320 | mkdir /mnt/defvol 321 | ``` 322 | 323 | Modify **fstab** to reflect the changes (remember to modify / entry and point it to /_active/rootvol. Add /tmp line too). It is interesting to add /mnt/defvol in order to mount the entire volume as it is described above too. Systemd sometimes creates /var/lib/machines subvolume so add it too. The fstab file should look like this: 324 | 325 | ``` 326 | # /etc/fstab: static file system information. 327 | 328 | # Use 'blkid' to print the universally unique identifier for a 329 | # device; this may be used with UUID= as a more robust way to name devices 330 | # that works even if disks are added and removed. See fstab(5). 331 | # 332 | # 333 | # 334 | UUID=238a2358-8bf6-47a9-907f-47eaece88632 /home ext4 defaults,rw,relatime,data=ordered 0 0 335 | UUID=ce5c80f2-9edd-42f6-b920-d8ae43ac461b / btrfs defaults,rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache,subvol=_active/rootvol 0 0 336 | UUID=ce5c80f2-9edd-42f6-b920-d8ae43ac461b /var/lib/machines btrfs defaults,rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache,subvol=/var/lib/machines 0 0 337 | UUID=ce5c80f2-9edd-42f6-b920-d8ae43ac461b /mnt/defvol btrfs defaults,rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache,subvol=/ 0 0 338 | UUID=4621e43f-3b86-4fa2-9d9e-823a564572f4 swap swap defaults 0 0 339 | ``` 340 | 341 | Reinstall GRUB (in my case, the PC was installed in BIOS legacy mode and GRUB is installed on /dev/sda): 342 | 343 | ``` 344 | grub-install --target=i386-pc /dev/sda 345 | grub-mkconfig -o /boot/grub/grub.cfg 346 | ``` 347 | 348 | Exit chroot and unmount everything. 349 | 350 | ``` 351 | exit 352 | umount /mnt -R 353 | ``` 354 | 355 | Reboot. 356 | Once the system is booted, check if **/** is pointing to **/_active/rootvol**. If everything is working fine, all the files within the root of the volume can be deleted. 357 | 358 | ``` 359 | cd /mnt/defvol 360 | sudo rm -rf b* 361 | sudo rm -rf d* 362 | sudo rm -rf e* 363 | sudo rm -rf h* 364 | sudo rm -rf l* 365 | sudo rm -rf m* 366 | sudo rm -rf o* 367 | sudo rm -rf p* 368 | sudo rm -rf r* 369 | sudo rm -rf s* 370 | sudo rm -rf t* 371 | sudo rm -rf u* 372 | ``` 373 | 374 | At this point, only **_active**, **_snapshots** and **var** should exist within **/mnt/defvol**. 375 | Go to **/mnt/defvol/_active/rootvol** and you can safely delete **_active** and **_snapshots**: 376 | 377 | ``` 378 | cd /mnt/defvol/_active/rootvol 379 | sudo rm -rf _active 380 | sudo rm -rf _snapshots 381 | ``` 382 | 383 | **DONE!!! :)** 384 | This is the [original post](http://unix.stackexchange.com/questions/62802/move-a-linux-instalation-using-btrfs-on-the-default-subvolume-subvolid-0-to-an) from I got the inspiration to do this stuff. 385 | 386 | ## Do you want to contact me? ## 387 | For more information, please check my [portfolio web page at https://egara.github.io](https://egara.github.io) 388 | -------------------------------------------------------------------------------- /files/arch-btrfs.conf: -------------------------------------------------------------------------------- 1 | title Arch Linux 2 | linux /vmlinuz-linux 3 | initrd /intel-ucode.img 4 | initrd /initramfs-linux.img 5 | options root=LABEL=arch rw rootflags=subvol=_active/rootvol 6 | -------------------------------------------------------------------------------- /files/fstab: -------------------------------------------------------------------------------- 1 | kk# /dev/sda3 LABEL=arch 2 | UUID=9882a07e-0a0c-419d-bbdd-cbfbc4a6ffc9 / btrfs rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvol=_active/rootvol 0 0 3 | 4 | # /dev/sda1 5 | UUID=3074-C66B /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2 6 | 7 | # /dev/sda3 LABEL=arch 8 | UUID=9882a07e-0a0c-419d-bbdd-cbfbc4a6ffc9 /home btrfs rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvol=_active/homevol 0 0 9 | 10 | # /dev/sda2 11 | UUID=9943adc7-d8a5-4500-bb35-3179aca961f5 none swap defaults 0 0 12 | 13 | UUID=9882a07e-0a0c-419d-bbdd-cbfbc4a6ffc9 /mnt/defvol btrfs rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvol=/ 0 0 14 | -------------------------------------------------------------------------------- /files/loader.conf: -------------------------------------------------------------------------------- 1 | timeout 3 2 | default arch-btrfs 3 | editor 0 4 | -------------------------------------------------------------------------------- /files/mkinitcpio.conf: -------------------------------------------------------------------------------- 1 | # vim:set ft=sh 2 | # MODULES 3 | # The following modules are loaded before any boot hooks are 4 | # run. Advanced users may wish to specify all system modules 5 | # in this array. For instance: 6 | # MODULES="piix ide_disk reiserfs" 7 | MODULES="" 8 | 9 | # BINARIES 10 | # This setting includes any additional binaries a given user may 11 | # wish into the CPIO image. This is run last, so it may be used to 12 | # override the actual binaries included by a given hook 13 | # BINARIES are dependency parsed, so you may safely ignore libraries 14 | BINARIES="" 15 | 16 | # FILES 17 | # This setting is similar to BINARIES above, however, files are added 18 | # as-is and are not parsed in any way. This is useful for config files. 19 | FILES="" 20 | 21 | # HOOKS 22 | # This is the most important setting in this file. The HOOKS control the 23 | # modules and scripts added to the image, and what happens at boot time. 24 | # Order is important, and it is recommended that you do not change the 25 | # order in which HOOKS are added. Run 'mkinitcpio -H ' for 26 | # help on a given hook. 27 | # 'base' is _required_ unless you know precisely what you are doing. 28 | # 'udev' is _required_ in order to automatically load modules 29 | # 'filesystems' is _required_ unless you specify your fs modules in MODULES 30 | # Examples: 31 | ## This setup specifies all modules in the MODULES setting above. 32 | ## No raid, lvm2, or encrypted root is needed. 33 | # HOOKS="base" 34 | # 35 | ## This setup will autodetect all modules for your system and should 36 | ## work as a sane default 37 | # HOOKS="base udev autodetect block filesystems" 38 | # 39 | ## This setup will generate a 'full' image which supports most systems. 40 | ## No autodetection is done. 41 | # HOOKS="base udev block filesystems" 42 | # 43 | ## This setup assembles a pata mdadm array with an encrypted root FS. 44 | ## Note: See 'mkinitcpio -H mdadm' for more information on raid devices. 45 | # HOOKS="base udev block mdadm encrypt filesystems" 46 | # 47 | ## This setup loads an lvm2 volume group on a usb device. 48 | # HOOKS="base udev block lvm2 filesystems" 49 | # 50 | ## NOTE: If you have /usr on a separate partition, you MUST include the 51 | # usr, fsck and shutdown hooks. 52 | HOOKS="base udev autodetect modconf block filesystems keyboard fsck btrfs" 53 | 54 | # COMPRESSION 55 | # Use this to compress the initramfs image. By default, gzip compression 56 | # is used. Use 'cat' to create an uncompressed image. 57 | #COMPRESSION="gzip" 58 | #COMPRESSION="bzip2" 59 | #COMPRESSION="lzma" 60 | #COMPRESSION="xz" 61 | #COMPRESSION="lzop" 62 | #COMPRESSION="lz4" 63 | 64 | # COMPRESSION_OPTIONS 65 | # Additional options for the compressor 66 | #COMPRESSION_OPTIONS="" 67 | -------------------------------------------------------------------------------- /files/upgrade-system.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if hash btrfs 2>/dev/null; then 3 | echo "Creating a read-only snapshot of the system. Please wait..." 4 | sudo btrfs subvolume snapshot -r /mnt/defvol/_active/rootvol/ /mnt/defvol/_snapshots/root-$(date "+%F") 5 | else 6 | echo "btrfs-progs not installed. Please, install it." 7 | fi 8 | 9 | echo "Upgrading the system. Please wait..." 10 | sudo pacman -Syu --noconfirm 11 | 12 | if hash yay 2>/dev/null; then 13 | echo "Upgrading the system from AUR. Please wait..." 14 | yay -Syua --noconfirm 15 | else 16 | echo "yay not installed. Please, install it." 17 | fi 18 | 19 | if hash snap 2>/dev/null; then 20 | echo "Upgrading snap packages. Please wait..." 21 | sudo snap refresh 22 | else 23 | echo "snapd not installed. Please, install it." 24 | fi 25 | --------------------------------------------------------------------------------