Is there something analogue to LVM logical volumes in BTRFS?

1

I like the way BTRFS does snapshots and subvolumes but it does not feel right to use LVM just because I want my logical volume to be of certain size.

Is there something analogue to LVM logical volumes in BTRFS? The closest thing to it seems to me to be the BTRFS subvolumes.

I am not reluctant to have BTRFS on top of LVM just because I want this. I am asking because if BTRFS does not have this functionality I will continue using LVM for the time being...

DejanLekic

Posted 2014-08-21T15:44:11.847

Reputation: 739

Answers

3

Btrfs subvolumes are not block devices, and thus don't have a fixed size. Why do you want to make it a specific size? Your question is analogous to asking "Is there a way to make a folder of specific size?" It will be the size of the contents, and you can't make it bigger or smaller short of adding or removing data from the subvolume.

If you want to limit a user from putting too much data on it, then enable a quota for the subvolume, which will cap it at a specified size.

Darth Android

Posted 2014-08-21T15:44:11.847

Reputation: 35 133

All you say is OK. Problem is that I want to limit (group of) users to specific amount of data on the subvolume without messing with quotas, etc. - At the moment I just give them access to a LVM logical volume, and all works well. Maybe I am thinking about using a wrong BTRFS feature as I am not a BTRFS expert... I will rephrase the question and remove "subvolume" from it. – DejanLekic – 2014-08-21T17:30:40.700

Is there a reason you don't want to mess with quotas? That is exactly what they are for. – Darth Android – 2014-08-21T18:14:01.930

1

Problem is that I want to limit (group of) users to specific amount of data on the subvolume without messing with quotas, etc. - At the moment I just give them access to a LVM logical volume, and all works well. Maybe I am thinking about using a wrong BTRFS feature as I am not a BTRFS expert... I will rephrase the question and remove "subvolume" from it.

I believe you are overengineering this.

I'm not completely familiar with Btrfs, but I believe I am familiar enough with ZFS from which Btrfs has drawn much inspiration to make heads and tails of this.

In both, you work with a blob of storage, which is subdivided into file systems which can have various properties set. For example, quotas for the file system. Btrfs calls this "subvolumes".

Just make a subvolume, set the quota to however much you want it to be possible to grow to (similar to your LVM logical volume size), then if everything is set up to support quotas in Btrfs do something like btrfs qgroup limit 1G <path>/<subvolume>. See the btrfs Wiki Use Cases page on implementing quotas for some more details on what to do if that doesn't work out immediately.

a CVn

Posted 2014-08-21T15:44:11.847

Reputation: 26 553

Yeah, I am aware I could do this with quotas (see my reply to Darth). Enabling quotas seem unnecessary complication for something I easily do with LVM logical volumes... – DejanLekic – 2014-08-21T18:00:07.377