This is OpenSUSE Leap 42. I have a computer with 2x 500 GB SATA HDD drives and to speed it up I put in a small 30GB SSD drive for the system. During installation HDDs were disconnected as they confused the installer (and me). Once system was up I quite easily exchanged the /home directory for a XFS logical volume (I use LVM primarily to add space easily). Then /opt filled up (chrome and botanicula) and I wanted to put that on a volume on HDD. So I created a volume and formatted it with BTRFS. After some head scratching – the @ subvolumes
in fstab made me read up on BTRFS I did what I needed – /opt now is 100 GB in size.
But the question is: Does it make sense to format a LVM volume with btrfs? Essentially they both are volume handling systems.
For illustration I paste my fstab (# comments show my edits) and vgscan + lvscan output:
~> cat /etc/fstab
UUID=1b511986-9c20-4885-8385-1cc03663201b swap swap defaults 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af / btrfs defaults 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /boot/grub2/i386-pc btrfs subvol=@/boot/grub2/i386-pc 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /boot/grub2/x86_64-efi bt
rfs subvol=@/boot/grub2/x86_64-efi 0 0
UUID=3e103686-52e9-44ac-963f-5a76177af56b /opt btrfs defaults 0 0
#UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /opt btrfs subvol=@/opt 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /srv btrfs subvol=@/srv 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /tmp btrfs subvol=@/tmp 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /usr/local btrfs subvol=@/usr/local 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/crash btrfs subvol=@/var/crash 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/lib/libvirt/images btrfs subvol=@/var/lib/libvirt/images 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/lib/mailman btrfs subvol=@/var/lib/mailman 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/lib/mariadb btrfs subvol=@/var/lib/mariadb 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/lib/mysql btrfs subvol=@/var/lib/mysql 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/lib/named btrfs subvol=@/var/lib/named 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/lib/pgsql btrfs subvol=@/var/lib/pgsql 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/log btrfs subvol=@/var/log 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/opt btrfs subvol=@/var/opt 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/spool btrfs subvol=@/var/spool 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /var/tmp btrfs subvol=@/var/tmp 0 0
UUID=30e20531-b7f1-4bde-b2d2-fab8eeca23af /.snapshots btrfs subvol=@/.snapshots 0 0
UUID=c4c4f819-a548-4881-b854-a0ed62e7952e /home xfs defaults 1 2
#UUID=e14edbfa-ddc2-4f6d-9cba-245d828ba8aa /home xfs defaults 1 2
~>
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "r0data" using metadata type lvm2
Found volume group "r0sys" using metadata type lvm2
# lvscan
ACTIVE '/dev/r0data/homer' [699.53 GiB] inherit
ACTIVE '/dev/r0sys/optr' [100.00 GiB] inherit
After the answer:
Thanks, I understand now the key differences. To me LVM is indeed better for managing space with whatever filesystems on top of it, but BTRFS should be used for features specific to it – mainly snapshots. In simple home network use it is probably better to stay away from it. I've had too much grief managing space on a small drive, but I'd imagine space would be eaten away also on big drives.
Best Answer
Maybe this explains ( from the btrfs wiki by the way )
A subvolume in btrfs is not the same as an LVM logical volume or a ZFS subvolume. With LVM, a logical volume is a block device in its own right (which could for example contain any other filesystem or container like dm-crypt, MD RAID, etc.) - this is not the case with btrfs. A btrfs subvolume is not a block device (and cannot be treated as one) instead, a btrfs subvolume can be thought of as a POSIX file namespace. This namespace can be accessed via the top-level subvolume of the filesystem, or it can be mounted in its own right.
see also https://btrfs.wiki.kernel.org/index.php/FAQ
Interaction with partitions, device managers and logical volumes
Btrfs has subvolumes, does this mean I don't need a logical volume manager and I can create a big Btrfs filesystem on a raw partition?
There is not a single answer to this question. Here are the issues to think about when you choose raw partitions or LVM:
.... the FAQ continues to explain the scenario's in which LVM+BTRFS make sense