Checking the Limits

Team-Fly    

Solaris™ Operating Environment Boot Camp
By David Rhodes, Dominic Butler
Table of Contents
Chapter 10.  Administering Quotas


At this point, everything is configured. Now, let's run some tests to check that it all works as expected. At the moment, testuser only has a small number of files, such as profiles and so on. So, checking testuser's quotas now will simply return without showing anything, unless we use the "verbose" option:

 hydrogen# quota testuser hydrogen# quota -v testuser Disk quotas for testuser (uid 500): Filesystem   usage  quota  limit  timeleft  files  quota  limit  timeleft /export/home     6 300000 500000                5    400    500 hydrogen# 

Testuser should be allowed to create files below its limit without any problems. Let's use testuser's account to create a file and check this:

 hydrogen# su - testuser hydrogen$ mkfile 100m file1 hydrogen$ ls l file1 -rw------T   1 testuser test  104857600  Sep 16 15:56 file1 hydrogen$ quota hydrogen$ quota -v Disk quotas for test (uid 500): Filesystem    usage  quota  limit  timeleft  files  quota  limit  timeleft /export/home 102465 300000 400000                7    400    500 hydrogen$ 

OK, that seems to work fine. Now let's create another file that will just push testuser over its soft limit:

 hydrogen$ mkfile 250m file2 quota_ufs: Warning: over disk limit (pid 369, uid 500, inum 5012,    fs /export/home) hydrogen$ ls l file* -rw------T   1 testuser test   104857600 Sep 16 15:56 file1 -rw------T   1 testuser test   262144000 Sep 16 15:56 file2 hydrogen# quota Over disk quota on /export/home, remove 58601K within 1.4 weeks hydrogen$ quota -v Disk quotas for test (uid 500): Filesystem    usage  quota  limit   timeleft  files  quota  limit  timeleft /export/home 358601 300000 500000  1.4 weeks      7    400    500 hydrogen$ 

Also, running a quota report on the filesystems will confirm that testuser has reached its soft limit:

 hydrogen# repquota -a /dev/dsk/c0t0d0s7 (/export/home):                       Block limits                   File limits User           used   soft   hard   timeleft  used  soft   hard   timeleft testuser  +- 358601 300000 500000  1.4 weeks     8    400    500 hydrogen# 

Now, we'll create one more file to push testuser over its hard limit. Although we will be able to create the file, we will be told that we are over our hard limit. From there, any other file we try to create will fail:

 hydrogen# su - testuser hydrogen$ mkfile 250m file3 quota_ufs: over hard disk limit (pid 375, uid 500, inum 5017,    fs /export/home) file3: Disc quota exceeded hydrogen$ ls l file* -rw------T   1 testuser test   104857600 Sep 16 15:56 file1 -rw------T   1 testuser test   262144000 Sep 16 16:15 file2 -rw------T   1 testuser test   262144000 Sep 16 16:56 file3 hydrogen$ quota Over disk quota on /export/home, remove 199993K within 1.4 weeks hydrogen$ rm file? hydrogen$ 

We can see that testuser may carry on storing data on the filesystem so long as the time period doesn't exceed the soft limit. After this time period has expired or testuser has exceeded its hard limit, testuser cannot store any more data on the system. In fact, if tried, testuser would see a similar error message to that shown.

We would also see a similar effect if testuser were to create a number of files that would take it over its file allocation limits. For example, running the following test script below would show this:

 hydrogen# su  testuser hydrogen$ cat testFileQuotas #!/bin/ksh count=0 while [ count -lt 550 ]; do   touch filenum$count   if [ $? -ne 0 ]; then     exit 1   else     count=$(($count + 1))   fi done hydrogen$ ./testFileQuotas quota_ufs: Warning: too many files (pid 3040, uid 500, fs /export/home) quota_ufs: over file hard limit (pid 3045, uid 500, fs /export/home) touch: filenum475 cannot create hydrogen$ quota v Disk quotas for test (uid 500): Filesystem    usage  quota  limit  timeleft  files  quota  limit  timeleft /export/home    154 300000 500000              500    400    500  1.43 weeks hydrogen$ rm filenum* hydrogen$ exit hydrogen$ 

    Team-Fly    
    Top
     



    Solaris Operating Environment Boot Camp
    Solaris Operating Environment Boot Camp
    ISBN: 0130342874
    EAN: 2147483647
    Year: 2002
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net