I have read about limiting size of directory - like creating big files, formatting,mount,.. etc. But this all very complicated. Does exist utility or something else to set limit on already existing directory?
When listing the contents of a directory using the ls command, you may have noticed that the size of the directories is almost always 4096 bytes (4 KB). That's the size of space on the disk that is used to store the meta-information for the directory, not what it contains.
To get the total size of a directory in Linux, you can use the du (disk-usage) command.
Quota is based upon filesystems, but you can always create a virtual filesystem and mount it on a specific (empty) directory with the usrquota and/or grpquota flags.
In steps this will be:
mount -o loop,rw,usrquota,grpquota /path/to/the/formatted/disk/space /path/of/mount/point
Tutorial here. Original answer here
You could limit the quota on a filesystem. But it is not directory specific, but file system & user specific.
You might also consider developping your own user space file system using FUSE, but this will take your time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With