1

I'm very new to lvm, and have simultaneously understood how Mac OS container disks work.

I'm very happy with Mac OS container disk semantics - I don't have to think how much space to allocate. I just create whatever volumes I want, and space gets magically allocated if I add files to a particular volume.

I assumed lvm would be the same but after creating a volume group vg1 that fills 100% of my disk, and creating a logical volume /dev/vg1/photos that is permitted to use 100% of the volume group, I cannot create a second disk /dev/vg1/videos that similarly has the potential to use the entire physical volume for its own contents (if I don't put anything in the /dev/vg1/photos logical volume).

sudo vgcreate vg1 /dev/sdf1
sudo lvcreate -n photos -l 2.73T vg1
sudo lvcreate -l 100%FREE -n photos vg1
mkdir /mnt/photos
sudo mkfs.ext4 /dev/vg1/photos
sudo mount /dev/vg1/photos /mnt/photos

Error - no unused space in volume group vg1

sudo lvcreate -l 100%FREE -n videos vg1

Am I correct in saying lvm's semantics are not identical to Mac OS volumes in this respect? In LVM, two logical volumes cannot automatically grab space from the same volume group without explicit, exclusive pre-allocation?

2 Answers2

1

ZFS is a closer equivalent to Mac OS CoreStorage volumes

The automatic pooling of storage space as illustrated in the OP can be achieved like this:

sudo apt install -y zfsutils-linux
sudo zpool create new-pool /dev/sdl11
sudo zpool status
sudo zfs create -o mountpoint=/mnt/audio new-pool/audio
sudo zfs create -o mountpoint=/mnt/books new-pool/books
# zfs mount new-pool/books
zfs list -o name,mountpoint
df

Lightweight filesystem creation

In ZFS, filesystem manipulation within a storage pool is easier than volume manipulation within a traditional filesystem; the time and effort required to create or expand a ZFS filesystem is closer to that of making a new directory than it is to volume manipulation in some other systems.

https://en.wikipedia.org/wiki/ZFS#Lightweight_filesystem_creation

Related reading

0

I think my understanding is going to evolve but here is what I see so far:

A thick volume is always fully-provisioned, which means that all of the capacity is allocated when the volume is created. A thin volume is always thinly-provisioned, which means that the capacity is allocated as the data is being written to the volume.

Contrary to what wikipedia says (https://en.wikipedia.org/wiki/Core_Storage#Notes - I think this is outdated).

Terminology

Mac OS Linux LVM
Physical Disk Physical Volume
Container Volume Group
Volume Logical Volume

Though in Mac OS 11 I think "Container" has been replaced with "Volume Group" in the Disk Utillity.app list.