Skip to main content

How to limit how much disk space a folder can use? [Resolved]

I have 2 hdd storage boxes I share with my linux server which has a SSD of ~500 GB.

I want to merge the 3 folders into one and I'm using unionfs for that. I need it to download data on it.

How can I limit how much my folder in my SSD can grow in size? I have other stuff running that needs the disk space too so if I ran out of space I'll have issues.

Also what would be the best way with unionfs/similar to have data written in SSD first then moved to hdd later? Is unionfs smart enough for that?

Question Credit: Freedo
Question Reference
Asked October 16, 2017
Tags: unionfs
Posted Under: Unix Linux
1 Answers

I see two possibilities:

dedicated volume

You can create a volume (e.g. with LVM) and mount it there. Then the folder is a separate filesystem and cannot grow beyond the filesystem size.


A less forceful approach (i.e. the users could circumvent it): You could create a group which is used for this folder only (which cannot be easily enforced). You could use the SGID bit on the folder to make all new files (just the created ones, not the moved ones, though) and define quota for this group.

credit: Hauke Laging
Answered October 16, 2017
Thanks for the quota solution. – Freedo 13 mins ago
 CanDoerz  1 month ago
Your Answer