Implementation on disk quota under Linux
Null Wangwei
〖Back〗 〖Forward〗
Implementation on disk quota under Linux
1. The question is proposed:
It is necessary to limit the user's use of a certain hard disk space on the server, which is necessary as a public server. Linux has a significant advantage over Windows NT in this regard.
2. Demand instructions:
You need to build an FTP server, there are multiple users in the system, you need to assign disk quotas as follows:
User name group home_dir quota ------------------------------------------- ------------- CO_USER01 Company01 / Home / Company 60MCO_USER02 Company01 / Home / Company ------------------------- ---------------------------------- User01 USER01 / Home / USER01 30M --------- -------------------------------------------------- User02 USER02 / HOME / USER02 30M ------------------------------------------------------------------------------------------------------------------------------------------------ ---------------- USER03 USER03 / HOME / USER03 30M
3. Solution step:
a. We use the system as Red Hat 5.2, and the user has set the account with the above requirements. b. Due to the use of RedHat5.2, the system kernel default is to support disk quotas, and start the script start disk quota service. (In /etc/rc.d/rc.sysinit, you can see the settings of Quotaon -a and Quotacheck -avug after all partitions are installed.)
c. Now (1999/04/10) Linux disk quota only supports EXT2 partition. At this time, we have to specify which partition in the system is required to do quota settings. You can edit / etc / fstab file to specify, original file: / dev / hda3 / ext2 defaults 1 1 / dev / hda1 / winnt vfaults 0 0 / dev / hda2 / my_ntfs NTFS DEFAULTS 0 0 0 / DEV / HDA4 SWAP SWAP DEFAULTS 0 0 / DEV / FD0 / MNT / FLOPPY EXT2 NOAUTO 0 0 0 / DEV / CDROM / MNT / CDROM ISO9660 NOAUTO, RO 0 0NONE / PROC PROC DEFAULTS 0 0 0 0
Change to / dev / hda3 / ext2 defaults, usrquota, Grpquota 1 1 / dev / hda1 / winnt vfaults 0 0 0 / dev / hda2 / my_ntfs NTFS DEFAULTS 0 0 0 / DEV / HDA4 SWAP SWAP DEFAULTS 0 0 0 / DEV / FD0 / MNT / FLOPPY EXT2 NOAUTO 0 0 0 / DEV / CDROM / MNT / CDROM ISO9660 NOAUTO, RO 0 0NONE / PROC PROC DEFAULTS 0 0
*** Don't write USRQUOTA to Userquota, and the consequences are not as simple as imagined.
d. Create an empty file quota.user and quota.group in the root of the partition to be quotable, specify the permissions as
Only root can be changed.
# Touch quota.user # Touch quota.group # chmod 600 quota.user # chmod 600 quota.group
E. At this time, we restart the system
# rebootf. After the system is restarted, we can use the Edquota command or LinuxConf software to divide the disk quota for the user.
It is easy to use LinuxConf. ...
g. This is complete, and use the repquota -a command to see. Reference http://mud.263.net/~linux/doc/cldp/mini/quota.html
WANGWEIMAILTO: Wangwei@computer-china.com
Linuxman@263.net