Disk reservation for a spesific program

Hello,

In what way can a program reserve disk space so that for example a specific folder always takes up 10gig and can not be filled up above that. I was thinking that the program may create its own partition or something but is there another solution for this?

EDIT:

I’ve also just thought about filling up a folder with empty files and replacing them as i add legitimate files to the folder but is there another way?

Partitioning is probably the best way of doing this, or you could create a virtual disk and mount that for the program to use,probably not as good performance as partitioning but it’s just a file so it’s more flexible.

I’m not sure if there’s a more elegant solution, is this on Windows?

BTRFS has built in support for quotas, without the need to repartition.

Most Linux filesystems support quotas, but they’re per user/group that owns the file and they’re enforced on a per filesystem level.

If you can limit the software to having write privileges only in that directory, or if you don’t mind all files and directories bring owned by a single user or group you can probably use built-in quota support.

Another option are btrfs subvolumes that can have a limited size.

Another option are lvm logical volumes.

Another option is a filesystem backed by a sparse file.

In the case of lvm and sparse file, you’ll want to enable discard/trim to be able to reclaim space from the underlying PV or filesystem when files are deleted