• Antergos on a BTRFS (B-tree file system)


    My journey with the BTRFS

    I haven’t much care about what file system I used in the past but after seeing that Antergos is implementing ZFS (Z File System) I began doing some of my own research about file systems and what the benefits of each one was and I could not believe that I was missing out all these years on all the great benefits of other file systems.

    The thing that made me jump up and down of excitement was reading that you can snapshot a partition. I still use a program called True Image for making snapshots of my Windows drive so I knew that snapshots are in every aspect an awesome feature to have.

    BTRFS snapshots also take no extra space because only files that change after a snapshot get written to disk. So you can have multiple Antergos snapshots running and they will share the files that are the same.

    Fast forward a few weeks later and I can say with a big smile that BTRFS is a must have and everyone should give it a try.

    I used this guide to get me up and running with BTRFS and its a brilliant read so go ahead and read it even if you don’t plan on implementing it now

    http://blog.fabio.mancinelli.me/2012/12/28/Arch_Linux_on_BTRFS.html

    Maybe one day I will write an installation guide on how I did these step to get Antergos working on BTRFS. Currently you have to install Antergos, select BTRFS in the installer and then after the installation finish, mount the partition, move the root and home files to their own subvolumes, edit the /etc/fstab file and reconfigure grub. But its not that hard.

    Hope this will get someone excited to try BTRFS

    BTRFS Features
    Writable snapshots, read-only snapshots
    Subvolumes (separate internal file system roots)
    Compression (zlib and LZO)
    Efficient Incremental Backup

    And a lot more, go check out the link below to view the full feature list
    https://btrfs.wiki.kernel.org/index.php/Main_Page

  • It’s maybe to late to answer, but…
    That’s exactly my project but I’m pretty inexperienced with btrfs.
    Can you please write a installation guide? It would be very helpful. Unfortunately I didn’t find any installation guide in the internet.

  • I will also partcipate ;)

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    http://kamprad.net/howto-installing-antergos/
    how to add system logs

  • My understanding is that you simply have to open a terminal to create the partitions and then only mount them with Cnchi.
    If i remember right I have done it that way and it works beside i don’t use subvolumes and systemd-boot instead of grub.

    mutze

    eternal noob

  • Hey @mrrenmo and @joekamprad
    I will check if I have time during the week to install Antergos in a Virtualbox with BTRFS. It was almost a year since I did the installation and need to check if I still remember all the steps and that nothing has change. The guide will not support UEFI if I make one.

  • I would like to see a guide!
    As I said I have it up and running without any problems, but Iam not good at writing anything down wich can help others. Iam sure your guide will be helpful at least for me at some time. I know myself enough for saying so…:smile:

    mutze

    eternal noob

  • Installing Antergos on BTRFS and make a snapshot afterword (Without EFI)
    WARNING - All data on the install hard drive will be deleted so make backups first before going on with this guide. I also take no resposibily for any damages of any kind or lost of data

    Boot the installation disk and install Antergos as normal.
    When the installer ask “How would you like to proceed”
    Select the option “Choose exactly where Antergos should be installed.”

    Select hard drive that you going to use for the BTRFS
    Click “New partition table”
    Select msdos click “apply”
    Click on free space
    Create a new swap partition - I always make my swap partition a little bigger than the total ram in my PC (9000MB) in my case
    Create a new BTRFS partition and mount it as root “/”

    Uncheck - Use the device below for boot loader installation

    Continue the installation as normal

    After the installation is complete say no to restart the computer

    Open the terminal (Not the ROOT terminal)
    Type in terminal

    su
    blkid
    

    Look in the printed list for the type btrfs partition - On my system it’s “/dev/sda2” and throughout the tutorial I am going to use sda2 but you should use your own partition name

    mount /dev/sda2 /mnt
    mkdir /mnt/__current
    
    btrfs subvolume create /mnt/__current/ROOT
    btrfs subvolume create /mnt/__current/home
    btrfs subvolume create /mnt/__current/pkg
    
    mv /mnt/* /mnt/__current/ROOT/
    mv /mnt/__current/ROOT/home/* /mnt/__current/home/
    mv /mnt/__current/ROOT/var/cache/pacman/pkg/* /mnt/__current/pkg/
    mkdir /mnt/__snapshot
    nano /mnt/__current/ROOT/etc/fstab
    

    Move the keyboard cursor to the line that got the “btrfs” in the line

    Delete everything after btrfs and add
    “ rw,relatime,compress=lzo,ssd,discard,space_cache,subvol=/__current/ROOT 0 0”

    If the BTRFS is not on a solid state remove “discard,” and “ssd,” on all lines

    On that line press “Ctrl + K”
    The line will disappear
    Press “Ctrl + U” 4 times

    You should now have 4 lines that is exactly the same

    Don’t change the first line and leave it

    The second line change “/” to “/home” and subvol to “subvol=/__current/home”
    The third line change “/” to “/var/cache/pacman/pkg” and subvol to “subvol=/__current/pkg”

    The fourth line change “/” to “/run/btrfs-root” and change everything after btrfs to “ rw,nodev,nosuid,noexec,relatime,compress=lzo,ssd,discard,space_cache 0 0”

    Press “Cntl + o”
    Press “Enter”
    Press “Cntl + x”

    My fstab file as example

    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    #
    UUID=000000000 swap swap defaults 0 0
    UUID=222222222 / btrfs  rw,relatime,compress=lzo,ssd,discard,space_cache,subvol=/__current/ROOT   0 0
    UUID=222222222 /home btrfs  rw,relatime,compress=lzo,ssd,discard,space_cache,subvol=/__current/home   0 0
    UUID=222222222 /var/cache/pacman/pkg btrfs  rw,relatime,compress=lzo,ssd,discard,space_cache,subvol=/__current/pkg   0 0
    UUID=222222222 /run/btrfs-root btrfs rw,nodev,nosuid,noexec,relatime,compress=lzo,ssd,discard,space_cache    0 0
    
    
    nano /mnt/__current/ROOT/etc/mkinitcpio.conf
    

    Look for the HOOKS line without “#” and add “ btrfs” to that line

    Press “Cntl + o”
    Press “Enter”
    Press “Cntl + x”

    If the BTRFS is not on a solid state remove “discard,” and “ssd,” on all lines

    mount -o defaults,relatime,discard,ssd,subvol=__current/ROOT /dev/sda2 /install
    mount -o defaults,relatime,discard,ssd,subvol=__current/home /dev/sda2 /install/home
    mount -o defaults,relatime,discard,ssd,subvol=__current/pkg /dev/sda2 /install/var/cache/pacman/pkg
    
    arch-chroot /install /bin/bash
    pacman -S grub os-prober
    

    This is the Hard drive without the partition number at the end (sda)

    grub-install /dev/sda
    grub-mkconfig -o /boot/grub/grub.cfg
    mkinitcpio -p linux
    

    Reboot and you will be using your new BTRFS

    Create read only snapshots

    sudo btrfs subvolume snapshot -r /run/btrfs-root/__current/ROOT/ /run/btrfs-root/__snapshot/ROOT_001
    sudo btrfs subvolume snapshot -r /run/btrfs-root/__current/home/ /run/btrfs-root/__snapshot/home_001
    

    This guide was made extremely quickly. I almost sure there is some errors I made but this is just an example. I still recommend reading that link in my first post

    Hope this help someone and sorry if I made any grammar or english spell errors.

  • I will check tomorrow if it works the way you describe it but Iam sure it will!
    Today there are some beers in the way and I need my system up and running for listening to my music.
    Many thanks for writing this and Iam sure that something like this belongs in the wiki!
    Btw your english is better than I will ever be able to write.
    Have I already say thanks?!

    mute

    eternal noob

  • @pyUser Many thanks for this great guide. It works in my VM as well. I will test the snapshot function with snapper in the next few days.
    I’ve found just a small typo. It should be “sda2” instead of “sdb2”.

    @pyUser said in Antergos on a BTRFS (B-tree file system):

    mount -o defaults,relatime,discard,ssd,subvol=__current/ROOT /dev/sdb2 /install
    mount -o defaults,relatime,discard,ssd,subvol=__current/home /dev/sdb2 /install/home
    mount -o defaults,relatime,discard,ssd,subvol=__current/pkg /dev/sdb2 /install/var/cache/pacman/pkg

  • Boot a snapshot with grub guide
    Making an extra copy of your system is always a good idea for testing new thing like installing new desktop environments or maybe try something that you think going to break the system.

    Lets begin
    First lets create a snapshot of your current system root and home folder

    sudo btrfs subvolume snapshot /run/btrfs-root/__current/ROOT/ /run/btrfs-root/__current/ROOTTEST
    sudo btrfs subvolume snapshot /run/btrfs-root/__current/home/ /run/btrfs-root/__current/hometest
    sudo nano /run/btrfs-root/__current/ROOTTEST/etc/fstab
    

    Change “/__current/ROOT” to "/__current/ROOTTEST"
    Change “/__current/home” to “/__current/hometest”

    Cntl+O
    Enter
    Cntl+X

    sudo gedit /boot/grub/grub.cfg
    

    Look for "### BEGIN /etc/grub.d/10_linux ###"
    Copy the menu entry just before submenu

    sudo gedit /etc/grub.d/40_custom
    

    Past the menu enter in that file
    You need to change 4 things in that file and don’t use find and replace because their are multiple places where the word “root” is use

    Just after menuentry change the ’ ’ to 'Arch Test’
    Then go and change every “__current/ROOT” to “__current/ROOTTEST”

    Run grub update

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

    And you are ready to reboot and boot in your second installation of Antergos to test new things without changing anything on the main system

    Hope this helps

  • I’ve created a video of pyUser’s instructions with a happy ending, for anyone who is interested: https://wheredoi.click/Antergos-btrfs-setup.webm

    Now I’m planning to tweak the setup a bit to optimize the mount options and subvolumes. My first attempts failed, mainly due to not following all the instructions literally in the beginning, and because I tried a UEFI setup too. I’ll post my results and reasons later.

    Antergos & Windows 7 Pro | Asrock x370 K4 - Ryzen 1600 - GTX 950 (replace with Radeon 570/580/Vega) - 16GB DDR4 2400 - Samsung 960 pro 512GB (Windows) + Samsung 850 EVO 256 GB (Antergos) + 2x 2TB HGST HDD + more storage - RM550x Gold PSU

  • @pyUser said in Antergos on a BTRFS (B-tree file system):

    BTRFS

    I use BTRFS on all my Linux computers ~ Haven’t found any negatives and makes file corruption errors obsolete!

    Also I use GUID-GPT, with BIOS (no UEFI)
    Partition BOOT unformatted + flags: boot, grub_bios

  • Hey @EarthMind
    Thanks for making the video… Enjoyed watching it

Posts 13Views 1543
Log in to reply