quota linux

14 Mar

quota, membatasi berapa banyak user menyimpan data ke sebuah folder

1. apakah sudah diinstall ?, jika belum diinstall
[root@wksvr ~]# rpm -ivh quota-3.13-1.2.3.2.el5.i386.rpm

2. edit /etc/fstab
[root@wksvr ~]# vi /etc/fstab
#/dev/hdb1 /u02 ext3 defaults 1 2
/dev/hdb1 /u02 ext3 defaults,grpquota,usrquota 1 2

3. remount
[root@wksvr ~]# mount -o remount /u02
[root@wksvr ~]# mount
/dev/hda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
/dev/hda4 on /u01 type ext3 (rw)
/dev/hdb1 on /u02 type ext3 (rw,grpquota,usrquota)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

4. bikin database [cepat / lambatnya proses tergantung besarnya kapasitas partisi]
[root@wksvr ~]# quotacheck -cugm /u02
[root@wksvr ~]# ls -l /u02/aquo*
-rw——- 1 root root 7168 Mar 14 10:31 /u02/aquota.group
-rw——- 1 root root 7168 Mar 14 10:31 /u02/aquota.user

5. setquota user
# setquota -u user bs bh is ih -a fs
user : username
bs : block soft limit
bh : block hard limit
is : inode soft limit
ih : inode hard limit
fs : filesystem

6. setquota group
# setquota -g group bs bh is ih -a fs
group : groupname
bs : block soft limit
bh : block hard limit
is : inode soft limit
ih : inode hard limit
fs : filesystem

7. test….test……[aku pilih group]
7a. setquota

misal ada group ws_matras dihatah 250 MB dalam server, maka setquota dapat di set sebagai berikut:
[root@wksvr ~]# setquota -g ws_matras 250000 250000 1000 1000 -a /u02/matras
nilai soft/hard block 250000
soft/hard inode 1000 [asumsi rata-rata 1 file berukuran 250 KB = 1000]

7b. Aktifkan quota
[root@wksvr ~]# quotaon -guva
/dev/hdb1 [/u02]: group quotas turned on
/dev/hdb1 [/u02]: user quotas turned on

7c. Cek quota group
[root@wksvr ~]# quota -g ws_matras
Disk quotas for group ws_matras (gid 1122):
Filesystem blocks quota limit grace files quota limit grace
/dev/hdb1 4 250000 250000 1 1000 1000

7d. report quota
7d.i. report quota setelah ditambahi file menjadi 29692

[root@wksvr ~]# repquota -a
*** Report for user quotas on device /dev/hdb1
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
———————————————————————-
root — 202792 0 0 4 0 0
SUJO — 8 0 0 2 0 0
#3679 — 29692 0 0 2 0 0

7d.ii. report quota setelah ditambahi file menjadi 189120
[root@wksvr ~]# repquota -a
*** Report for user quotas on device /dev/hdb1
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
———————————————————————-
root — 202792 0 0 4 0 0
SUJO — 8 0 0 2 0 0
#3679 — 189120 0 0 3 0 0

7d.iii. report quota setelah ditambahi file menjadi 189120
[root@wksvr ~]# repquota -a
*** Report for user quotas on device /dev/hdb1
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
———————————————————————-
root — 202792 0 0 4 0 0
SUJO — 8 0 0 2 0 0
#3679 — 189120 0 0 3 0 0

7d.iv. saat ditambahi lebih dari 250MB, lewat samba – akses windows
muncul “error There is not enough free disk space”

8. edit quota [250 MB –> 25GB]
[root@wksvr u02]# edquota -g ws_matras
Disk quotas for group ws_matras (gid 1122):
Filesystem blocks soft hard inodes soft hard
/dev/hdb1 4 25000000 25000000 1 100000 100000

6 Responses to “quota linux”

  1. Fakhrul Arifin March 16, 2009 at 8:49 am #

    wah blognya keren

    dengan ini saya bisa belajar dengan baik……

    oh ya om jangan lupa kunjungi blog saya

    http://fakhrul92.wordpress.com

  2. jamel virgiawan March 18, 2009 at 3:53 am #

    alo kk

    blog na keren bgt

    ajarin donk buat blog kerenn

    n dont forget to visit my blog

    http://jamelblog.wordpress.com/

  3. Mas Rony April 27, 2009 at 1:16 pm #

    Bos, disc quota setau saya bisa running hanya apabila partisi /home berdiri sendiri (asumsi yang dibatasi disc quota di /home). Ndak nyampur dengan yang lain. Kalo campur dengan yang lain bisa tah bos?

    • setijoagus April 28, 2009 at 6:14 am #

      pd kasusku, kok bisa ya tidak harus dipisahkan partisinya.

      • Mas Rony April 28, 2009 at 12:44 pm #

        gini pak. soalnya dulu tau ilmu soal quota disuruh make partisi tersendiri (seingat saya dulu make RH0), dan selama ini kalo saya bikin partisi /home juga kadung terbiasa berdiri sendiri. Makanya asumsi tersebut melekat sampe sekarang.
        Baru tau kalo boleh bebas / campur dengan partisi lain setelah baca artikel pak agus ini. Ntar deh pak kalo pas maen quota2-an saya nyoba campur dengan partisi lain. Thanks infonya bos

      • setijoagus April 29, 2009 at 12:40 am #

        ya, paling benar dicoba dulu, kl misalnya aku salah tolong diralat ya Mas Rony…..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: