how to create a folder with a limited size?

General support questions
Post Reply
WeatherReport
Posts: 5
Joined: 2019/11/19 05:55:00

how to create a folder with a limited size?

Post by WeatherReport » 2019/11/21 16:51:55

Hey, I want to have a folder but limiting the size of that folder to 5Gb How to do that in CentOs 7?

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

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

Post by jlehtone » 2019/11/21 16:58:43

Sounds like you want to set quota. XFS supports project quotas, which might suit your need.

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

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

Post by MartinR » 2019/11/21 17:41:15

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.

WeatherReport
Posts: 5
Joined: 2019/11/19 05:55:00

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

Post by WeatherReport » 2019/11/21 23:36:34

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

Gerb
Posts: 5
Joined: 2018/08/16 09:53:19

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

Post by Gerb » 2019/11/27 17:47:18

With ZFS you can create folders (zfs partitions) that have a maximum size.

Post Reply