P. 1
Unix Toolbox

Unix Toolbox

4.9

|Views: 702|Likes:
Published by Edycop
Collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users.
Collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users.

More info:

Published by: Edycop on Oct 21, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

01/06/2014

pdf

text

original

Adiskquotaallowstolimittheamountofdiskspaceand/orthenumberoffilesauseror(or
memberofgroup)canuse.Thequotasareallocatedonaper-filesystembasisandareenforced
by the kernel.

19.1Linux setup

The quota tools package usually needs to be installed, it contains the command line tools.
Activatetheuserquotainthefstabandremountthepartition.Ifthepartitionisbusy,eitherall
lockedfilesmustbeclosed,orthesystemmustberebooted.Addusrquotatothefstabmount
options, for example:

20.http://www.sqlite.org

— Disk Quota —

48

/dev/sda2 /home reiserfs rw,acl,user_xattr,usrquota 1 1
# mount -o remount /home
# mount

# Check if usrquota is active, otherwise reboot

Initialize the quota.user file withquotacheck.

# quotacheck -vum /home
# chmod 644 /home/aquota.user

# To let the users check their own quota

Activatethequotaeitherwiththeprovidedscript(e.g./etc/init.d/quotadonSuSE)orwith
quotaon:

quotaon -vu /home

Check that the quota is active with:

quota -v

19.2FreeBSD setup

Thequotatoolsarepartofthebasesystem,howeverthekernelneedstheoptionquota.Ifitis
not there, add it andrecompilethe kernel.

options QUOTA

As with Linux, add the quota to the fstab options (userquota, not usrquota):

/dev/ad0s1d /home ufs rw,noatime,userquota 2 2
# mount /home

# To remount the partition

Enable disk quotas in /etc/rc.conf and start the quota.

# grep quotas /etc/rc.conf
enable_quotas="YES"

# turn on quotas on startup (or NO).

check_quotas="YES"

# Check quotas on startup (or NO).

# /etc/rc.d/quota start

19.3Assign quota limits

Thequotasarenotlimitedperdefault(setto0).Thelimitsaresetwithedquotaforsingleusers.
Aquotacanbealsoduplicatedtomanyusers.Thefilestructureisdifferentbetweenthequota
implementations,buttheprincipleisthesame:thevaluesofblocksandinodescanbelimited.
Onlychangethevaluesofsoftandhard.Ifnotspecified,theblocksare1k.Thegraceperiodis
set withedquota -t. For example:

# edquota -u colin

Linux

Disk quotas for user colin (uid 1007):
Filesystem blocks soft hard inodes soft hard
/dev/sda8 108 1000 2000 1 0 0

FreeBSD

Quotas for user colin:
/home: kbytes in use: 504184, limits (soft = 700000, hard = 800000)
inodes in use: 1792, limits (soft = 0, hard = 0)

For many users

Thecommandedquota-pisusedtoduplicateaquotatootherusers.Forexampletoduplicatea
reference quota to all users:

— Disk Quota —

49

# edquota -p refuser `awk -F: '$3 > 499 {print $1}' /etc/passwd`
# edquota -p refuser user1 user2

# Duplicate to 2 users

Checks

Userscanchecktheirquotabysimplytypingquota(thefilequota.usermustbereadable).Root
can check all quotas.

# quota -u colin

# Check quota for a user

# repquota /home

# Full report for the partition for all users

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->