I. Prepare partitions
/Dev/hda1 (ext2/ext3 format)
2. Prepare the user directory
Add User u1, U2
# Useradd u1
# Passwd u1
# Useradd U2
# Passwd U2
Iii. Mount
(1) manual mounting
Mount-O usrquota, maid/dev/hda1/mnt/hda1
(2) automatic mounting
# Vi/etc/fstab
Add
/Dev/hda5/mnt/hda5 ext3 defaults, usrquota, kgquota 0 0
Iv. Directory preparation
# Mkdir/mnt/hda5/u1dir
# Mkdir/mnt/hda5/u2dir
# Chown u1.u1 u1dir
# Chown u2.u2 u2dir
5. Create a quota database file
(1) manually create
# Touch/mnt/hda5/aquota. USR
# Touch/mnt/hda5/aquota. Group
(2) Automatic Creation
# Quotacheck-cvuga
6. Edit the quota database file
# Edquota u1
# Edquota U2
Requirements: U1 space limit: soft limit 8 K, hard limit 12 K
U1 file limit: soft limit 3, hard limit 5
U2 space limit: 12 K soft limit and 24 k hard limit
U1 file limit: soft limit 6, hard limit 10
7. Enable quota
# Quotaon-
8. Verification
Log On With U1 and U2 respectively
U1 Logon
$ Quota view quota
$ CD/mnt/hda5/u1
$ Echo "hi"> file1
$ Echo "hi"> file2
$ Echo "hi"> file3
At this time, a message will be prompted, indicating that the U1 user's space usage restrictions start warning.
In addition, the content in file3 is empty because the hard space limit of 12 KB is used up.
$ Quota U1 check the latest status
$ Echo "hi"> file4 file4 content is blank
$ Echo "hi"> file5
An error occurred while creating the file5 file. The message "the disk quota is used up" is displayed"