Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-05-2011, 03:16 AM   #1
LQ Newbie
Registered: Jun 2011
Posts: 22

Rep: Reputation: Disabled
how to restrict directory size ?


I need to know how to limit directory size.

As example,
I have directory in /root called as "shared". i already shared this directory using NFS. i want to limit this directory size into 20 GB (20*1024*1024). That means "shared" directory reserved 20 GB disk space from the HDD.

how can i solve this problem ?,

Someone told me about disk quota. I don't hv a knowledge to apply this into my problem...

Old 08-05-2011, 04:05 AM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913
Easiest way: put it on a 20G partition by itself.

Different way: implement group quotas, make sure
the dir in question has sticky groups all the way
through and implement a quota on the group.

Old 08-05-2011, 09:25 PM   #3
LQ Guru
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,796
Blog Entries: 27

Rep: Reputation: 4638Reputation: 4638Reputation: 4638Reputation: 4638Reputation: 4638Reputation: 4638Reputation: 4638Reputation: 4638Reputation: 4638Reputation: 4638Reputation: 4638
Using quotas is the best way.

Here's a good intro to quotas.
Old 08-09-2011, 06:42 AM   #4
Registered: Aug 2011
Posts: 64

Rep: Reputation: Disabled

Try to write a script to check size of this directory and modify acces rights.

to get size
du -h --max-depth=0 directroy/ |cut -f1

generics array

Last edited by salemeni; 12-06-2011 at 03:54 AM.
0 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to restrict the perl array maximum size? ashok.g Programming 7 02-09-2010 09:37 AM
Restrict download of file of certain size using squid. linuxlover.chaitanya Linux - Server 7 12-06-2008 07:22 PM
To restrict maximum download file size in Squid proxy satishap Linux - Security 3 05-23-2008 03:09 AM
how to restrict max folder size on nfs shares?? j4jaybi Red Hat 1 07-28-2006 01:32 PM
restrict file type & size with vsftpd? zovres Linux - Software 0 06-24-2005 03:23 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:21 PM.

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