On 03/14/2016 07:20 PM, Anton Aylward wrote:
On 03/14/2016 06:06 PM, Carlos E. R. wrote:
On 2016-03-14 23:03, Anton Aylward wrote:
On 03/14/2016 02:43 PM, Carlos E. R. wrote:
The fact is, if you are using btrfs, you need several subvolumes each tuned differently. As simple as that.
No you don't. I removed subvolumes from my BtrFS RootFS a long time ago. I *chose* to have *some* of the replaced by mountable partitions. But it is still possible to have, for example, /tmp and /opt and /var as plain old directories (which they are anyway).
I know this is possible because I did it before I decided to move them off into separate file systems.
Of course you can replace them with real partitions. If you don't, you should keep the subvolumes.
Please explain why one should keep the subvolumes?
I am not a BTRFS expert by any means but let me try my best to explain it... For example, /var/lib/libvirt/images you can refer to this thread https://lists.opensuse.org/opensuse-factory/2016-01/msg00434.html Also /var/lib/mariadb is another example, it will have issues if you keep COW enabled as the database has small changes written to disk frequently and using COW causes performance issues in these cases[1]. This is why the sobvolume is mounted with the nodatacow (C) attribute: linux-n93l:~ # lsattr /var/lib/ ---------------- /var/lib/libvirt ---------------- /var/lib/mailman ---------------C /var/lib/mariadb ---------------- /var/lib/named ---------------C /var/lib/pgsql ... linux-n93l:~ # lsattr /var/lib/libvirt/ ---------------C /var/lib/libvirt/images ---------------- /var/lib/libvirt/boot ---------------- /var/lib/libvirt/filesystems ... These subvolumes also have the added benefit of preventing the snapshots that are auto configured for the / partition to snapshot the default DB or VM directories which helps prevent issues where BTRFS complains about a disk being full when in "reality" it isn't.
I've been told that subvolumes can be snapshotted, whereas folders can't be. That's not so in my experience. I had /etc/ (as well a /bin and /lib...) as a folder not a subvolume and still they were snapshotted when, for example, a zypper upgrade package brought about a change to config file.
The directories inside of / are all part of the root volume. Remember, snapshots for the / volume are not taken for the subvolumes! If you want to see subvolumes of a BTRFS partition you can use (I cut off a bunch of output, just kept interesting stuff): linux-n93l:~ # btrfs subvolume list / ID 257 gen 15202 top level 5 path @ ID 258 gen 75083 top level 257 path @/.snapshots ID 259 gen 69209 top level 258 path @/.snapshots/1/snapshot ID 267 gen 75074 top level 257 path @/var/lib/libvirt/images ... ID 816 gen 75162 top level 258 path @/.snapshots/355/snapshot ID 881 gen 59458 top level 258 path @/.snapshots/405/snapshot ID 882 gen 59458 top level 258 path @/.snapshots/406/snapshot ... You can see that the .snapshots directory is a subvolume (to prevent is from being taken in during a snapshot) and so is /var/lib/libvirt/images. Also notice that the snapshots themselves are actually just subvolumes that contain either a snapshot of file from some time or a link to the file on the FS: linux-n93l:~ # ls -l /.snapshots/405/snapshot/bin/ total 5244 lrwxrwxrwx 1 root root 13 Oct 14 10:44 arch -> /usr/bin/arch lrwxrwxrwx 1 root root 21 Dec 17 23:44 awk -> /etc/alternatives/awk lrwxrwxrwx 1 root root 17 Oct 14 10:44 basename -> /usr/bin/basename -rwxr-xr-x 1 root root 656552 Oct 25 05:04 bash ... If you try the same for a path that is a subvolume you should see something like this: linux-n93l:~ # ls -l /.snapshots/1/snapshot/var/lib/libvirt/ total 0 drwx--x--x 1 root root 0 Jan 14 15:02 boot drwxr-xr-x 1 root root 318 Feb 7 10:16 dnsmasq drwx--x--x 1 root root 0 Jan 14 15:02 filesystems drwxr-xr-x 1 root root 0 Dec 17 23:11 images drwx------ 1 root root 0 Jan 14 15:02 network drwxr-x--- 1 qemu qemu 56 Feb 5 22:51 qemu Hope that made some sense as to why those subvolumes are created. [1] https://wiki.archlinux.org/index.php/Btrfs#Copy-On-Write_.28CoW.29 -- Regards, Uzair Shamim