LinuxQuestions.org
Review your favorite Linux distribution.
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 01-01-2007, 10:24 AM   #1
just_me_then
Member
 
Registered: Dec 2006
Posts: 59

Rep: Reputation: 15
Disk Quota... in MB?


Hi,
I have set a system up so i can limit the amout of space a user can use. The question i have is this. What numbers do i put in!

I know for example that i want this user to have a hard limit of 250MB. So do i just put 250 under hard, or does it need to be in a diffrent format?

Disk quotas for user localtest (uid 503):
Filesystem blocks soft hard inodes soft hard
/dev/sdb2 0 0 0 0 0 0


Many thanks

Last edited by just_me_then; 01-01-2007 at 10:29 AM.
 
Old 01-01-2007, 10:36 AM   #2
xjlittle
Member
 
Registered: Aug 2003
Location: Indiana
Distribution: fc6 sles9 & 10 kubuntu ubuntu-server
Posts: 240
Blog Entries: 2

Rep: Reputation: 30
disk quotas are set using blocks and are set on a per file system (partition) basis. /home should be on it's own partition. Divide the number of blocks by the number of users if you want all users to have the same amount of disk space.

You can use the command
Code:
fdisk -l
to view the number of blocks
 
Old 01-01-2007, 10:40 AM   #3
just_me_then
Member
 
Registered: Dec 2006
Posts: 59

Original Poster
Rep: Reputation: 15
thanks... Is there a way that i can work out how many blocks there are to a single MB?
 
Old 01-01-2007, 11:16 AM   #4
xjlittle
Member
 
Registered: Aug 2003
Location: Indiana
Distribution: fc6 sles9 & 10 kubuntu ubuntu-server
Posts: 240
Blog Entries: 2

Rep: Reputation: 30
This should get you close. Divide the number of blocks on the partition by the 1024. This will give you the blocks per megabyte. Multiply the blocks per megabyte times the number of megabytes that you want a user to have. This will give you the number of blocks to use.

For instance I have a partition with 12586896 blocks. I know this by using the fdisk -l command I mentioned earlier. Now divide that by 1024:
Code:
[root@john-fc6 jslittl]# expr 12586896 \/ 1024
12291
So I have 12291 blocks per MB. If I want a user to have 20 MB I multiply that by 20:
Code:
[root@john-fc6 jslittl]#  expr 20 \* 12291
245820
I would give that user 245820 blocks as a hard limit.

hth
 
Old 01-01-2007, 02:05 PM   #5
just_me_then
Member
 
Registered: Dec 2006
Posts: 59

Original Poster
Rep: Reputation: 15
Fantastic! Many Thanks.
 
Old 01-01-2007, 06:22 PM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
The "df" or "fdisk -l" listings assume the blocks are 1K blocks. So there are 1024 1-k blocks per Megabyte.

Double check that your file-system uses 1K blocks. According to the Coreutils manual:
Quote:
2.3 Block size
Some gnu programs (at least df, du, and ls) display sizes in “blocks”. You can adjust
the block size and method of display to make sizes easier to read. The block size used for
display is independent of any file system block size. Fractional block counts are rounded up
to the nearest integer.
I think that the blocksize is determined by the filesystem used and how it was formatted. The blocksize used by df and du are conveniences. On my system, "stat -f %B" displays 512 byte blocks regardless of what I am checking.

Check your own documentation on what blocksize quota uses on your own system. I don't know offhand if quota uses an arbitrary blocksize or gets it from the filesystem. And I won't assume an answer for me is the correct answer for you.

The ext2 filesystem can have 1024, 2048, and 4096 bytes per block as an option to mkefs. You can check on the blocksize of a fileystem with the debugfs program.

Last edited by jschiwal; 01-01-2007 at 07:22 PM.
 
  


Reply


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
Disk Quota mdk3 Linux - Software 2 04-12-2005 06:44 PM
disk over quota blacbastard Linux - General 1 11-20-2003 10:44 AM
disk over quota blacbastard Solaris / OpenSolaris 1 11-19-2003 09:26 AM
Disk quota jcb_dreamvsat Linux - Security 4 07-13-2003 08:37 PM
disk quota iquadri1 Linux - Networking 1 09-29-2001 01:58 PM


All times are GMT -5. The time now is 02:23 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration