Page 1 of 1

how to create a folder with a limited size?

Posted: 2019/11/21 16:51:55
by WeatherReport
Hey, I want to have a folder but limiting the size of that folder to 5Gb How to do that in CentOs 7?

Re: how to create a folder with a limited size?

Posted: 2019/11/21 16:58:43
by jlehtone
Sounds like you want to set quota. XFS supports project quotas, which might suit your need.

Re: how to create a folder with a limited size?

Posted: 2019/11/21 17:41:15
by MartinR
There's another fairly horrible way to do it:
  • Create a 5 GiB file using dd(1).
  • Create a filesystem within the file (mkfs(8)).
  • Mount it on the directory whose size you wish to limit.

Re: how to create a folder with a limited size?

Posted: 2019/11/21 23:36:34
by WeatherReport
jlehtone wrote:
2019/11/21 16:58:43
Sounds like you want to set quota. XFS supports project quotas, which might suit your need.
I planned to limiting folder size for samba user, i want to know what is the good option and how quota compared to xfs tools for example xfs_quota?

https://linux.die.net/man/8/xfs_quota

Re: how to create a folder with a limited size?

Posted: 2019/11/27 17:47:18
by Gerb
With ZFS you can create folders (zfs partitions) that have a maximum size.