Ubuntu system to disk quotas (Quota)

Source: Internet
Author: User

Requirements: Disk quotas for the USB drive, different users of different usage capacity


First step: Install the quota command

sudo apt-get Install quota


650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/82/93/wKiom1dbhyOhyVnAAAGHyMQX10k893.png "title=" Quota01.png "alt=" Wkiom1dbhyohyvnaaaghymqx10k893.png "/>


The second step: partition the USB drive, the total capacity is divided into one partition

sudo fdisk/dev/sdb

N->p->enter->enter->enter->w

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/82/92/wKioL1dbjfGjzpTSAADjgPaMkMw418.png "title=" Quota03.png "alt=" Wkiol1dbjfgjzptsaadjgpamkmw418.png "/>



Step three: Format the partition (EXT3)

sudo mkfs.ext3/dev/sdb1

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/82/93/wKiom1dbjYvgP5dSAACiQ8oR8u8315.png "title=" Quota04.png "alt=" Wkiom1dbjyvgp5dsaaciq8or8u8315.png "/>

Ask for information, enter (enter) on the line


Fourth step: Mount Partition/DEV/SDB1

sudo mkdir/mnt/quotadir

sudo mount/dev/sdb1/mnt/quotadir/

Mount | grep sdb1

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/82/94/wKiom1dbkb3QiMGrAABB8VgE-zM803.png "title=" Quota05.png "alt=" Wkiom1dbkb3qimgraabb8vge-zm803.png "/>


Fifth step: Permissions for quotas for this directory

sudo mount-o remount,usrquota,grpquota/mnt/quotadir/

Mount | grep sdb1

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/82/92/wKioL1dbk-agGEKIAABM4h8f1ik243.png "title=" Quota06.png "alt=" Wkiol1dbk-aggekiaabm4h8f1ik243.png "/>


Sixth step: Establish quota record file, Quotacheck scan on the line

sudo quotacheck-avug

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/82/94/wKiom1dblI7Dkp82AAD3nJhu7Dg073.png "style=" float: none; "title=" Quota07.png "alt=" Wkiom1dbli7dkp82aad3njhu7dg073.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/82/94/wKiom1dblI7A8dh9AABWpXZLJwY895.png "style=" float: none; "title=" Quota08.png "alt=" Wkiom1dbli7a8dh9aabwpxzljwy895.png "/>


Seventh step: Open and close the quota service

Open: sudo quotaon-vug/mnt/quotadir/

Off: sudo quotaoff-vug/mnt/quotadir/

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/82/92/wKioL1dbmCWiD5vGAAB9vRciTLs485.png "title=" Quota10.png "alt=" Wkiol1dbmcwid5vgaab9vrcitls485.png "/>


Eighth step: Create two users in the same group, followed by space quotas for these two users

sudo groupadd quotagroup

Cat/etc/group | grep quotagroup

sudo useradd-g quotagroup quotauser1

sudo useradd-g quotagroup quotauser2

cat/etc/passwd | grep quota

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/82/94/wKiom1dbmNGAOk3wAACcpws1fr8786.png "title=" Quota11.png "alt=" Wkiom1dbmngaok3waaccpws1fr8786.png "/>


Nineth Step: Assign a limit to a specified user or group

Assign a 250M limit to quotauser1, not more than 300m:sudo edquota-u Quotauser1

Assign a 250M limit to quotauser2, not more than 300m:sudo edquota-u Quotauser2

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/82/92/wKioL1dbnT2iuCaaAAAS-yvtDM8252.png "style=" float: none; "title=" Quota13.png "alt=" Wkiol1dbnt2iucaaaaas-yvtdm8252.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/82/94/wKiom1dbnDDgEH_GAABw1J19rZY662.png "style=" float: none; "title=" Quota12.png "alt=" Wkiom1dbnddgeh_gaabw1j19rzy662.png "/>

The second user, by the same token, writes his own

Assign a 500M limit to the Quotagroup group, not more than 600m:sudo edquota-g Quotagroup

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/94/wKiom1dbnV_TsxJFAAAT2BeoXNU307.png "style=" float: none; "title=" Quota15.png "alt=" Wkiom1dbnv_tsxjfaaat2beoxnu307.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/92/wKioL1dbnmyC1GlTAAAtlJG_rnI303.png "style=" float: none; "title=" Quota14.png "alt=" Wkiol1dbnmyc1gltaaatljg_rni303.png "/>

Set Grace time 14 days: sudo edquota-t

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/82/92/wKioL1dboA7DHXZ2AAAT2BeoXNU061.png "style=" float: none; "title=" Quota15.png "alt=" Wkiol1dboa7dhxz2aaat2beoxnu061.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/82/94/wKiom1dbnwGiNjFQAABOuUdZeBY814.png "style=" float: none; "title=" Quota17.png "alt=" Wkiom1dbnwginjfqaabouudzeby814.png "/>


Tenth step: Show the user or group limit phenomenon

Display user quotas: sudo quota-uvs quotauser1 quotauser2

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/82/92/wKioL1dboQCA_0ntAAB5Oueci68036.png "title=" Quota18.png "alt=" Wkiol1dboqca_0ntaab5oueci68036.png "/>

Show group quotas: sudo Quota-gvs quotagroup

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/82/92/wKioL1dboWaBL3kmAABBVB6wWBo539.png "title=" Quota19.png "alt=" Wkiol1dbowabl3kmaabbvb6wwbo539.png "/>


11th Step: Display quota information for the file system

Show Users: sudo repquota-auvs

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/82/94/wKiom1dbobOTV3FDAADEZDSEYFs153.png "title=" Quota20.png "alt=" Wkiom1dbobotv3fdaadezdseyfs153.png "/>

Show groups: sudo Repquota-agvs

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/82/92/wKioL1dbovXAjZhKAAB-Rk1QM9A725.png "title=" Quota21.png "alt=" Wkiol1dbovxajzhkaab-rk1qm9a725.png "/>


12th step: Test is valid

Switch User: sudo su quotauser1

Create a large file: dd If=/dev/zero of=bigfile bs=1m count=270

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/82/94/wKiom1dbpGCCPEVOAADAXZ50VIw320.png "title=" Quota22.png "alt=" Wkiom1dbpgccpevoaadaxz50viw320.png "/>

Switch back to the main user view: sudo repquota-auvs

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/82/94/wKiom1dbpXvwLdGDAACgkSLhhEU153.png "title=" Quota23.png "alt=" Wkiom1dbpxvwldgdaacgkslhheu153.png "/>

When you write again, you will get an error, only the capacity of the upper value size can be written

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/82/94/wKiom1dbpmiyQsJsAACy4HXD2c4254.png "title=" Quota24.png "alt=" Wkiom1dbpmiyqsjsaacy4hxd2c4254.png "/>




Complete.

Ubuntu system to disk quotas (Quota)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.