Why does the tumbleweed opensuse fstab contain so many btrfs subvol entries

btrfsopensuse

What is the purpose/reasoning/technical-reason why my opensuse tumbleweed system has so many folders of my filesystem "wrapped" (not sure if that's the right word) as sub volumes on btrfs?

Does it have something to do with btrfs snapshots?

Many of the entries are subdirectories of /var, and then my home directory is mapped in fstab as xfs. What is the reason for these two filesystem types? I suspect that it has something to do with the fact that btrfs can "revert" failed system updates using its snapshots, but I don't understand why not just create a tiny non-btrfs filesystem and mount it on /var?

Besides lots of /var directories, it seems /opt /src and /tmp have subvolume entries. Here is a complete unmodified factory-defaults-only fstab from my tumbleweed system.

Besides the usual SWAP and the / which is btrfs, what is surprising to me is the sheer volume of subvolumes.

UUID=fd443d26-5ded-4f57-a51e-824eec3d2199 swap swap defaults 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 / btrfs defaults 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /opt btrfs subvol=@/opt 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /srv btrfs subvol=@/srv 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /tmp btrfs subvol=@/tmp 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /usr/local btrfs subvol=@/usr/local 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/crash btrfs subvol=@/var/crash 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/lib/libvirt/images btrfs subvol=@/var/lib/libvirt/images 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/lib/mailman btrfs subvol=@/var/lib/mailman 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/lib/mariadb btrfs subvol=@/var/lib/mariadb 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/lib/mysql btrfs subvol=@/var/lib/mysql 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/lib/named btrfs subvol=@/var/lib/named 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/lib/pgsql btrfs subvol=@/var/lib/pgsql 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/log btrfs subvol=@/var/log 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/opt btrfs subvol=@/var/opt 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/spool btrfs subvol=@/var/spool 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /var/tmp btrfs subvol=@/var/tmp 0 0
UUID=7126f15f-0443-4e1d-b74e-406266534887 /.snapshots btrfs subvol=@/.snapshots 0 0
UUID=edf9aa3f-621f-40d2-9e7a-433b50673642 /home                xfs        defaults              1 2

Best Answer

I believe that btrfs is now the preferred filesystem if you want to allocate your whole disc (or most of it) to a filesystem. It is often (always) chosen now for root. Yes, snapshots are a big part of that. The booting system can now actually boot from a previous snapshots, and snapshots are taken automatically. It's saved me once.

The xfs filesystem is chosen for home directories only if you chose to separate it from root, and I believe it has to do with how often the files in home directories change, but I may be smoking something. It seems to be much more supported these days than ext3 or ext4. Here's an openSUSE thread on the question, with no real answer: https://forums.opensuse.org/showthread.php/501150-BTRFS-Question-gt-13-1-to-13-2

Related Question