LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-11-2021, 08:33 AM   #1
stoorky
Member
 
Registered: Sep 2015
Posts: 63

Rep: Reputation: Disabled
Is there a file system out there that supports custom file size limit ?


Hi,
I'm aware that EXT4 has a
Code:
max_dir_size_kb
mount option to set up the max size of each directory. It doesn't have a similar option to specify the max size of individual files, though.

Is somebody aware of another file system that could do this ? I checked XFS, ZFS and ReiserFS, but didn't find anything, though I'm no expert on those file systems.

To be more specific about what I try to achieve : I'd like to limit the size of individual files that can be stored on a Samba share (individual files, not global quota, e.g. prevent users from storing files exceeding a given size). Samba doesn't have an option for this, and the Linux /etc/security/limits.conf doesn't work either with Samba (see https://askubuntu.com/questions/1315...4-ubuntu-20-04, and the answer below : the Samba developers explained that file size limits set up in /etc/security/limits.conf are not enforced).

So my idea was to define that limit on the file system level, but it doesn't appear there is a file system supporting this feature.
 
Old 02-11-2021, 07:03 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,640

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
Quote:
Originally Posted by stoorky View Post
Hi,
I'm aware that EXT4 has a
Code:
max_dir_size_kb
mount option to set up the max size of each directory. It doesn't have a similar option to specify the max size of individual files, though.

Is somebody aware of another file system that could do this ? I checked XFS, ZFS and ReiserFS, but didn't find anything, though I'm no expert on those file systems.

To be more specific about what I try to achieve : I'd like to limit the size of individual files that can be stored on a Samba share (individual files, not global quota, e.g. prevent users from storing files exceeding a given size). Samba doesn't have an option for this, and the Linux /etc/security/limits.conf doesn't work either with Samba (see https://askubuntu.com/questions/1315...4-ubuntu-20-04, and the answer below : the Samba developers explained that file size limits set up in /etc/security/limits.conf are not enforced).

So my idea was to define that limit on the file system level, but it doesn't appear there is a file system supporting this feature.
Have you researched the QUOTA system? I have never attempted to apply it to a SAMBA share, but it may have application here.
 
Old 02-12-2021, 02:48 AM   #3
stoorky
Member
 
Registered: Sep 2015
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by wpeckham View Post
Have you researched the QUOTA system? I have never attempted to apply it to a SAMBA share, but it may have application here.
Quotas are for global restrictions, per share, but don't allow to limit the size of each file
 
Old 02-12-2021, 03:34 AM   #4
lvm_
Member
 
Registered: Jul 2020
Posts: 933

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Don't know about such filesystems but user file size restrictions can be set either via ulimit from shell or more restrictively via pam_limits in limits.conf. Hope that helps.
 
Old 02-12-2021, 04:36 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,876

Rep: Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315Reputation: 7315
It looks like there is no direct way (long time ago):
https://unix.stackexchange.com/quest...d-on-file-size
 
Old 02-12-2021, 05:12 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Maybe attack it from the other end - watch the mount-point and delete any big files (after the event). Definite kludge, but should work - doesn't help if you have real constraints in the network bandwidth or actual disk shortages.
 
Old 02-12-2021, 03:04 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
I pondered this question a bit yesterday.

Most file systems are made to get most out of it. Making it less is contrary to design. However as noted some controls could be in place for things like quota or size of share or such.

The question remains if one could modify a file system with source code to add in a specifed limit. I think so but you may have to do something like iscsi on nas. Samba will kill it otherwise. Might be possible to use NFS.

The problem is that a smart cookie could split up some large file and escape this restriction.

Best just to limit total quota. Let them beg for more.

Last edited by jefro; 02-12-2021 at 03:07 PM.
 
Old 02-22-2021, 01:23 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Quotas can be set per user - at least on Linux disk. Never tried it on a Samba share, but if the underlying disk is Linux, it should work - I think.
 
  


Reply

Tags
ext4, file system, limit, limits.conf, zfs



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix complaining that "message size exceeds limit" even when below limit size psycroptic Linux - Server 12 03-27-2019 10:21 PM
is there a file size limit to tar backups? seanarthur Linux - Server 1 08-22-2006 09:01 PM
Is there a size limit that Linux recognizes? alfy Linux - Hardware 4 05-30-2003 12:28 PM
is there a limit to file size in Linux (RH 7.2) hemlock Linux - Newbie 6 09-06-2002 07:06 PM
Is there a way round the 2gb File size Limit smurf Linux - General 2 07-10-2002 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration