15

I've read a fair bit about btrfs's subvolumes feature. While it would seem interesting to have subvolumes for the main categories in a data filesystem, such as @films, @pictures, @music... What advantage does this provide over just having folders?

Will I need to mount each subvolume? Or will the subvolumes appear like folders under the root mount point? i.e for a /data mount point will I have: /data/pictures, /data/music, etc

3 Answers 3

9

Subvolumes under the default root subvolume appear as folders and do not need to be mounted if you've mounted the root subvolume.

The difference between a folder and a subvolume is that subvolumes can be mounted without mounting either the parent subvolume (root) or any other subvolume. And subvolumes can be snapshotted, whereas folders can't be.

2
  • Unmounted subvolumes are read-only.
    – Dennis
    Mar 16, 2015 at 12:59
  • Dennis' comment above is totally wrong. unmounted but accessible subvolumes retain their read/write or read-only attribute whether or not they are mounted. Aug 3, 2020 at 14:59
8

The answer to your either/or question is "both". Yes, you'll have to mount each subvolume. Each subvolume behaves like a normal file system, so they will appear in mount points like /etc.

There are a few advantages to that idea. For instance, you could make your MySQL database directory into a subvolume, which would enable you to take snapshots for use with backups. You could also choose to make that directory into a RAID1, so that if one disk failed, your database would still be intact. Another is using a subvolume for /etc so that you could always reverse any kind of system wide configuration changes. Using a subvolume for /home/username would potentially allow each user to have a time machine, though probably in a much more flexible way than what Apple provides in their system.

And of course, one benefit of having a subvolume for homes and another for the root is the ability to reverse an upgrade. For instance, you upgrade from 12.04 to 12.10 very early, discover that it's a tad too buggy after the first month, so you just un-upgrade your operating system. I haven't tried that myself, but it should work just as good as keeping your home and reinstalling the previous system, except it would take about a second insted of an hour. :)

2
  • I know this answer is rather old, but I could use a tip right now: You made the statement that one can pick a different replication level per subvolume. Can you give a source or a small howto to that? I was unable to find any and am kinda unable to use this feature (although I'd really like to!) I'm always ending up with the whole system in single or in RAID1 mode. Jan 26, 2013 at 20:52
  • 1
    @JonasWielicki Currently, different replication levels per subvolume are not implemented: unix.stackexchange.com/questions/82869
    – ignis
    Nov 4, 2013 at 11:56
0

Subvolume feature, using the current Ubuntu kernel (from ubuntu 12.10), doesn't make much sense as it still misses "Subvolume Quota Groups". You have to wait kernel 3.6 (maybe ubuntu 13.04 ?) You can snaphost a subvolume of course, and of course you can't snapshot a directory. But you probably expect subvolumes to work like Logical Volumes with LVM, but with btrfs we don't have an alike scenario, as we don't have quota extension with this kernel.

Therefore: yes, you can make snapshots, but they look like directories, and if you fill the space on a subvolume, you fill the space on the whole filesystem.....

You can even resize a subvolume, by giving the path of the subvolume, but the resize operation affects the whole filesystem, and not the path of the subvolume.

In other words, with this kernel, subvolume is not production ready.

Otherwise, you have to use btrfs filesystems as volumes, and not subvolumes. btrfs filesystem can be shrinked on-line, and extended on-line, and therefore quota is not necessary.

1
  • I had a look to BTRFS on SysrescuCD and it has quota extension. But the kernel is 3.4. Perhaps they patched the kernel to enable this extension (??).... anyway, resizing ZFS volumes works fine, whereas it doesn't work with BTRFS. That's why we need quota. Mar 5, 2013 at 13:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .