{"id":742,"date":"2017-04-29T23:02:48","date_gmt":"2017-04-29T20:02:48","guid":{"rendered":"https:\/\/helia.ee\/koolitus\/?page_id=742"},"modified":"2018-07-10T00:42:41","modified_gmt":"2018-07-09T21:42:41","slug":"centos-7-disk-quota-conf","status":"publish","type":"page","link":"https:\/\/helia.ee\/koolitus\/?page_id=742","title":{"rendered":"Centos 7 &#8211; Disk Quota Conf"},"content":{"rendered":"<p>As a Linux system admin we generally face low disk space issues. By implementing the user and group disk quota on the file system we can resolve the space issue.<\/p>\n<p>Quota restricts the users to use only allowed disk and inodes on the particular file system. In this post we will discuss how to enable user &amp; group disk quota on \/home File system on CentOS 7 &amp; RHEL 7<\/p>\n<h5>Esimene k\u00e4sk &#8211; Yum install Quota<\/h5>\n<p>Loo failid\u00a0<strong>\/home\/quota.user<\/strong> ja\u00a0\/home\/quota.group (debianil on need failid\u00a0aquota.user ja\u00a0aquota.group)<\/p>\n<pre><strong>touch 600 \/home\/quota.user \r\ntouch 600 \/home\/quota.group\r\ntouch 600 \/home\/aquota.user \r\ntouch 600 \/home\/aquota.group\r\n\r\nchmod 600 \/home\/quota.user\r\nchmod 600 \/home\/quota.group\r\nchmod 600 \/home\/aquota.user \r\nchmod 600 \/home\/aquota.group\r\n\r\n<\/strong><\/pre>\n<p><strong>#Debian`il<br \/>\nchmod 600 \/home\/aquota.user<br \/>\nchmod 600 \/home\/aquota.group<\/strong><\/p>\n<p>&nbsp;<\/p>\n<h5>Step:1 Add usrquota &amp; grpquota option on \/home in \/etc\/fstab file.<\/h5>\n<pre>[root@linuxtechi ~]# vi \/etc\/fstab\r\n\r\n<strong>Seal lisa usrquota ja grpquota n\u00e4ide. siin \/dev\/hda2 \/home ext3 defaults,usrquota,grpquota 1 1<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3009\" src=\"http:\/\/www.linuxtechi.com\/wp-content\/uploads\/2015\/03\/home-quota.png\" alt=\"home-quota\" width=\"700\" height=\"183\" \/>u<\/p>\n<p>Save &amp; exit the file.<\/p>\n<p>In this example i have add user and group quota options on \/home<\/p>\n<h5>Step:2 Remount\u00a0 \/home file system via\u00a0 mount command<\/h5>\n<pre>[root@linuxtechi ~]# mount -o remount \/home<\/pre>\n<p>Now recheck the \/home file system whether Quota is enable or not.<\/p>\n<pre>[root@linuxtechi ~]# mount | grep \/home\r\n\/dev\/mapper\/centos-home on \/home type ext4 (rw,relatime,seclabel,quota,usrquota,grpquota,data=ordered)<\/pre>\n<h5>Step:3 Create Quota Database Files using quotacheck<\/h5>\n<pre>[root@linuxtechi home]# quotacheck -cugv \/home\r\n\r\nkui eelmine k\u00e4sk annab vea siis proovida seda <strong>quotacheck -cfmvF vfsv0 \/home<\/strong><\/pre>\n<p>Whereas :<\/p>\n<p>-c : create quota file and don\u2019t use the existing file<br \/>\n-v : verbose ouput<br \/>\n-u : user disk quota<br \/>\n-g : group disk quota<\/p>\n<p>Above Command will create aquota.user &amp; aquota.group files under \/home<\/p>\n<p>Turn on quota on \/home using below command :<\/p>\n<pre>[root@linuxtechi ~]# quotaon \/home\/\r\n\r\n#kui tekib probleeme quota on k\u00e4suga, siis lase need k\u00e4sud l\u00e4bi\r\n1. quotaoff -guvp -a \r\ngroup quota on \/home (\/dev\/hda7) is off \r\nuser quota on \/home (\/dev\/hda7) is off \r\n2. mount -o remount \/home \r\n3. quotacheck -cguvamf -F vfsv0 \r\n4. quotaon -a \r\n\r\n<\/pre>\n<h5>Step:4 Assign user &amp; group disk quota via edquota commands<\/h5>\n<p>Syntax # edquota -u &lt;User_Name&gt;<\/p>\n<p># edquota -g &lt;Group_Name&gt;<\/p>\n<pre>[root@linuxtechi ~]# edquota -u jack<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3011\" src=\"http:\/\/www.linuxtechi.com\/wp-content\/uploads\/2015\/03\/edquota.png\" alt=\"edquota\" width=\"698\" height=\"78\" \/><\/p>\n<pre>[root@linuxtechi ~]# edquota -g sys_admin<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3010\" src=\"http:\/\/www.linuxtechi.com\/wp-content\/uploads\/2015\/03\/group-quota.png\" alt=\"group-quota\" width=\"702\" height=\"74\" \/><\/p>\n<p>As shown above we have two kind of <strong>Disk quota limits<\/strong> :<\/p>\n<p><strong>soft<\/strong> : It will warn the users if the soft limit of disk quota reached ( size is in KB), in above example for jack user soft limit is 5500 KB ( approx 5.5MB )<\/p>\n<p><strong>hard<\/strong> : It will not allow the users to create new files once the hard limit is reached. ( Size in KB ), in above example hard limit for jack user is 6000 KB ( approx 6 MB )<\/p>\n<p><strong>Note<\/strong> : We can also set the Quota on the basis of the inodes ( i.e numbers of files that the user can create on particular file system)<\/p>\n<p>Let\u2019s take an example , login as jack user and try to create a file of 8MB.<\/p>\n<pre>[root@linuxtechi ~]# su - jack\r\n\r\n[jack@linuxtechi ~]$ dd if=\/dev\/zero of=bgfile bs=1M count=8\r\ndm-2: warning, user block quota exceeded.\r\ndm-2: write failed, user block limit reached.\r\ndd: error writing \u2018bgfile\u2019: Disk quota exceeded\r\n6+0 records in\r\n5+0 records out\r\n6144000 bytes (6.1 MB) copied, 0.00711317 s, 864 MB\/s<\/pre>\n<p>As we see above soft &amp; hard limit is exceeded for jack user. Now onwards user jack can\u2019t create new files.<\/p>\n<p>&nbsp;<\/p>\n<h5>Step:5 Display Quota report for Users in human readable<\/h5>\n<pre>[root@linuxtechi ~]# repquota -as<\/pre>\n<h5><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3008\" src=\"http:\/\/www.linuxtechi.com\/wp-content\/uploads\/2015\/03\/repquota.png\" alt=\"repquota\" width=\"703\" height=\"166\" \/><\/h5>\n<h5>Step:6 Configure Grace Period for Soft Limit<\/h5>\n<p>Grace period is the amount of time during which soft limit can can be exceeded, once the grace period reached then soft limit will become the hard limit.<\/p>\n<p>Use the edquota command to set Grace period .<\/p>\n<pre>[root@linuxtechi ~]# edquota -t<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3013\" src=\"http:\/\/www.linuxtechi.com\/wp-content\/uploads\/2015\/03\/Soft-limit-grace-period.png\" alt=\"Soft-limit-grace-period\" width=\"697\" height=\"103\" \/><\/p>\n<p>Please don\u2019t hesitate to share your feedback and comments on this post ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a Linux system admin we generally face low disk space issues. By implementing the user and group disk quota on the file system we can resolve the space issue. Quota restricts the users to use only allowed disk and inodes on the particular file system. In this post we will discuss how to enable [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":645,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-742","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/742","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=742"}],"version-history":[{"count":9,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/742\/revisions"}],"predecessor-version":[{"id":977,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/742\/revisions\/977"}],"up":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/645"}],"wp:attachment":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}