Re: Quota support, kernel move from 2.2 to 2.4
From: Jonny Quest (Jonny_at_quest.org)
Date: 02/02/04
- Previous message: Peter Herttrich: "Re: The rise and fall of linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 02 Feb 2004 04:06:37 -0800
Nathan Higgins wrote:
> Ok, maybe google doesn help:
>
> http://unixhelp.ed.ac.uk/CGI/man-cgi?convertquota+8
>
> I ran:
> convertquota -ug /dev/hda2
> convertquota -ug /dev/hda3
> convertquota -ug /dev/hdc1
>
> It created new files:
> -rw------- 1 root root 32 Jun 26 00:52 aquota.group.new
> -rw------- 1 root root 32 Jun 26 00:52 aquota.user.new
>
> Old files were:
> -rw------- 1 root root 36320 Jun 26 00:52 quota.group
> -rw------- 1 root root 553856 Jun 26 00:52 quota.user
>
> Do these files contain the actual quota info for each user (with a size of
> 32 bytes i can't see how!!)
> Am i doing something wrong or can this just not be done?
>
> Nathan D Higgins
>
>
Here are my notes. This snippet might be useful. to answer your
question specifically the aquota files do not contain any quota info
till you add it. Unless the convert quota command worked for you.
Edit fstab and reboot (one time deal)
Edit the /etc/fstab file so the system will know to do quotas on the
selected filesystem(s).
The keyword usrquota must be added to the fstab file for the file
system that contains home directories /home.
Edited the file system table to include quotas for the slice where the
users pages will live (have to reboot for this to take effect or at
least unmount and remount /home:
more /etc/fstab
/dev/md2 / ext3 defaults 1 1
/dev/md0 /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
/dev/md3 /home ext3 defaults,usrquota
1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/md1 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660
noauto,owner,kudzu,r
o 0 0
/dev/fd0 /mnt/floppy auto
noauto,owner,kudzu 0 0
reboot # reboot the machine (will mount the devices for quota)
Turn quota on (one time deal)
This was easy. Just create the file
touch /home/aquota.user
Added a startup script to make the system check quotas and turn it on.
Needs to be executable so use the same permissions as the rest of the
scripts in /etc/init.d
ls -la /etc/init.d/quota
-rwxr-xr-x 1 root root 329 Jan 31 07:25 /etc/init.d/quota
Made a symbolic link so it runs at startup
ln -s /etc/init.d/quota /etc/rc2.d/S92quota
Check it to see if it linked
ls –la /etc/rc2.d
lrwxrwxrwx 1 root root 15 Jan 31 08:03 S92quota ->
../init.d/quota
here is the script /etc/init.d/quota
#!/bin/bash
#
#
# start-up script to turn on quotas for filesystem
#
#
# Check quota then turn quota on.
if [ -x /sbin/quotacheck ]
then
echo "Checking quotas. This may take some time."
/sbin/quotacheck -avug
echo " Done checking quotas. "
fi
if [ -x /sbin/quotaon ]
then
echo "Turning on quota."
/sbin/quotaon -avug
fi
Set a 10MB quota for one user at a time
To setup a quota for a single user run the edquota command. This puts
you into a vi editor from which you will need to change blocks soft to
10000 and Blocks hard to 12000. this will set it to 10MB soft limit and
15MB hard limit.
/usr/sbin/edquota template
Disk quotas for user template (uid 502):
Filesystem blocks soft hard inodes
soft hard
/dev/md3 208 0 0 33
0
After editing it should read
Disk quotas for user template (uid 502):
Filesystem blocks soft hard inodes
soft hard
/dev/md3 208 10000 12000
33 0
Set a quota for many users at once
This is how we can setup the same quota as a existing user all at once.
It will take the quota we set up for user template and copy those
setting to all others. It will do this for users with UIDs starting
with UID 500. This assumes that the users started with 500
and will go from there. Also assumes username template exists
edquota -p template `awk -F: '$3 > 499 {print $1}' /etc/passwd`
Next we will check all users quotas
repquota -a
*** Report for user quotas on device /dev/md3
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 60 0 0 5 0 0
scott -- 644 10000 12000 147 0 0
tracy +- 307040 10000 12000 7days 36 0 0
template -- 208 10000 12000 33 0 0
- Previous message: Peter Herttrich: "Re: The rise and fall of linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|