LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-15-2009, 11:04 AM   #1
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Rep: Reputation: 31
quick quota setting?


I have a Suse Linux 10 system with quota already installed, but it is not enabled.

Is there a way to quickly enable a quota that is the same for all users?

If not, does anyone have a script that can set the same quota for every user on the system individually?

Last edited by davidstvz; 04-15-2009 at 11:07 AM.
 
Old 04-15-2009, 11:12 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Use the setquota command using a loop over user names:
Code:
for name in user0 user1 user2 user3
do
  setquota -u $name W X Y Z filesystem
done
where W, X, Y, Z are the block-softlimit, the block-hardlimit, the inode-softlimit and the inode-hardlimit respectively. filesystem is the actual filesystem with quota. Then turn quotas on using the quotaon command.
 
Old 04-15-2009, 11:44 AM   #3
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
What if I have to loop over several hundred user names?
 
Old 04-15-2009, 11:54 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Have you a list of them? Or can you retrieve all of them with a simple command?

If they are in a list (one username per line) just do
Code:
while read name
do
  setquota -u $name W X Y Z filesystem
done < namelist.txt
if you can retrieve them using a command, just do
Code:
for name in $(some_command)
do
  setquota -u $name W X Y Z filesystem
done
 
Old 04-15-2009, 12:06 PM   #5
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by colucix View Post
Have you a list of them? Or can you retrieve all of them with a simple command?

If they are in a list (one username per line) just do
Code:
while read name
do
  setquota -u $name W X Y Z filesystem
done < namelist.txt
if you can retrieve them using a command, just do
Code:
for name in $(some_command)
do
  setquota -u $name W X Y Z filesystem
done
I should be able to generate a list from the passwd file easily enough.

So the only variables in that code I need to replace are W X Y Z and filesystem?

The size values are specified in bytes I guess. What is a reasonable number of inodes for a 120 GB partition? And filesystem refers to a partition? How do I specify it by device id? Like /dev/sdc1

Sorry to be such a noob.
 
Old 04-15-2009, 05:03 PM   #6
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Wait, I'm seeing some other stuff on the web. Do I need to edit the fstab and change the way the disks are mounted? I'm still confused here.

quota is installed by default, but it's not enabled. I guess I need to go into init.d and fix all that up. I'm not sure how to do that.

Last edited by davidstvz; 04-15-2009 at 05:13 PM.
 
Old 04-15-2009, 06:33 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
fstab should contain mount args usrquota (and grpquota if you need it) and they'll be used when the FSes are mounted. Since fstab takes quota args it seems reasonable to expect mountpoints, not devicenames. Take into account users don't have any business in say /boot, /usr (unless your perception of filesystems is severely skewed) so you could focus on areas where they do like /home and /var (mailspools and such). You could use the values of one "average" user to come up with "average" values for XYZ. One lame quck way to initialise quota (to get some values) could be to run 'quotacheck -cugamMf' but YMMV(VM).
 
Old 04-17-2009, 04:33 PM   #8
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Thanks very much. With your help and this page, I was able to reign in the singular user that caused the problem. On Monday I will use a script to get the rest: http://www.yolinux.com/TUTORIALS/Lin...ialQuotas.html

Thanks,
 
  


Reply



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
A doubt on Quota setting... rajeshkerala Linux - Newbie 2 03-13-2008 01:08 PM
Setting disk quota in LINUX y.sudhir.rao Linux - General 2 08-08-2006 03:14 AM
Setting disk quota ray5_83 Linux - General 1 08-09-2004 04:57 AM
QQQ (Quick Quota Quest) wolftechmn Linux - Software 0 11-27-2003 05:09 AM
Setting a user quota SMB3Master Linux - General 8 08-26-2003 05:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:52 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