DISK QUOTA SOFT AND HARD LIMITS.

ITEM: RTA000036300



QUESTION:                                                                       
My question has to do with implementing disk quota on AIX/6000 3.2.             
We currently do not have disk quota implemented and users are taking            
up what ever resources they need.  We have tested disk quota and                
seems to perform as we expect it.                                               
                                                                                
1)  The difference between soft and hard limits.  I would guess that            
we would want our soft limits to be lower than the hard limitd.  We             
are looking at 5 MB soft limit and 9 MB hard limit with the default             
7 days grace period.  What happens to the user data if he has exceeded          
his soft limit and does not take any action on the disk quota                   
warning for 7 days?  The information seems to imply that soft limit             
becomes the hard limit.  If that's the case he may have 4 MB worth of           
data that is lost.  Is this recoverable?                                        
                                                                               
2) Since we currently do not have quota implemented, users have more            
than 5 MB data stored on the disks.  What happens to their data when            
we enable disk quota?  Do we have to have users remove their data and           
get it below 5 MB before we can enable disk quota?                              
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
A: 1)  What is the difference between hard and soft limits?                     
                                                                                
      A user can never exceed the hard limit.  However the soft limit           
   can be exceeded for duration of the grace period.  Usually the soft          
   limit is less than the hard limit.  Sometimes, a user will temporarily       
   need more disk space than the soft limit allows.  For example, when          
   compiling a program, many large object files are created.  The system        
   allows you to temporarily pass this SOFT LIMIT for such activities,          
   so you won't get any "out-of-space" quota errors while doing                
   something on the system that temporarily needs a lot of disk space.          
   The assumption is that these temporary files will be erased soon             
   afterward, within the grace period, so that your disk usage is again         
   below the soft limit.                                                        
                                                                                
      The true maximum disk quota is the HARD LIMIT which you can never         
   exceed.  Since going over the soft limit is considered a temporary           
   privilege, if the user passes the soft limit and the grace period            
   expires, then the user's privilege is taken away and the soft limit          
   becomes his/her hard limit.  For straightforward disk quotas, set the        
   hard limit equal to the soft limit.  For quotas with a little leeway,        
   you can set the hard limit above the soft limit.                             
                                                                                
      If the soft limit becomes the hard limit after an expired grace           
   period, the extra data will NOT be erased.  The only consequence is         
   that the user will not be able to create files until the user has            
   removed files to fit within the soft limit.                                  
                                                                                
   2)  Can you impose a disk quota when data already exists?                    
                                                                                
      Yes you can enable disk quotas when users already have existing           
   data.  The new disk quotas will go into affect immediately.  If the          
   user previously had more data than the new HARD LIMIT allows, he/she         
   will not be able to create any additional files until he/she erases          
   files so that disk usage is within the hard limit (preferably the            
   soft limit).  The existing data will NOT be erased.                          
                                                                                
      I was able to find the information in InfoExplorer articles               
   "Disk Quota System Overview" and "How to Set Up the Disk Quota               
   System".                                                                    
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
QUESTION:                                                                       
I have a couple more questions. What type of message does the                   
user get?  Would he get this message in his application window or does          
he have to do something from an AIX prompt.  Most of our users only             
use the applications which are automatically kicked off.  There is NO           
AIX window available (open) for them.                                           
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
- We have quota running on our lab machines, I see that there are               
  two files quota.user and quota.group in the root directory of the             
  filesystem as I would have expected.  But when I do ls -la I get the          
  following:                                                                    
                                                                               
-rw-r-----   1 root     system    256320 Nov 08 16:14 quota.group               
-rw-r-----   1 root     system   31999968 Nov 08 16:14 quota.user               
                                                                                
  I hope that it's not an indication of the size.  I know that my               
filesystem is not this large so there is a discrepency some where.              
                                                                                
- Do we have to use 'edquota' command, every time we add a new user.            
  Is there another command that allows us to set the user quota when            
  we create the user id.  Also, do we have to 'edquota' for all the             
  existing users.  Or is the ever friendly script required to                   
  accomplish this task?                                                         
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
A:       The quota is imposed from the command line prompt and within an        
   application.  For example, when I was in an application like "vi"           
   and tried to save a file that would put me over the hard limit disk          
   quota, I received the following error message:                               
                                                                                
      Disk quota exceeded .Warning - "filename" is incomplete.                  
                                                                                
   AIX allowed me to continue the "vi" session, but I could not save            
   the file.  (The workaround is to shell escape, recover disk space,           
   re-enter vi and then save the file).  In other applications, like            
   "smit" that wrote to a the smit.log, I received the following error          
   message with smit.log would be increased past the hard disk quota:           
                                                                                
      /home: operation failed, user disk quota limit reached                    
                                                                                
   "smit" allowed me to continue with my session but did not further            
   append to the smit.log file.  I am not sure exactly which applications      
   you are are running so I cannot test what exact error messages would         
   occur.  However, I suspect that when the users disk quota is exceeded        
   he/she will receive similar error messages as well.                          
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
A:    I used testing to find the answers to your questions, since I was         
   not able to find any pertinent documentation.                                
                                                                                
   1) When I set up disk quotas on the lab systems, I saw that two              
      extremely "large looking" files called quota.user and quota.group         
      were created.  I say "large looking" because the files were not           
      really as large as "ls" claimed.  The two files quota.user and            
      quota.group are known as "sparse" files.  A common use of "sparse"        
      files is for databases.  Here, a file is created to allocate room         
      for a large database by creating an inode structure with pointers        
      which point to NULL data blocks (to force allocation of disk              
      space).  I am not sure whether the following fact is working-as-          
      designed or a defect, but "du" and "df" do not count NULL data            
      blocks as being used, and the system will allocate that space when        
      requested by another file.                                                
                                                                                
         In my test, ls reported quota.user was a size of 297984 bytes,         
      about 297 KB.  However, du and df showed only this file only              
      occupied 20 KB (du and df did not count the NULL data blocks).  I         
      was able to allocate new files to take up the space of quota.user's       
      NULL data blocks.                                                         
                                                                                
         Therefore, your 256 KB quota.group file and 3 GB quota.user file       
      are actually taking much less space on the disk than shown by ls.         
      You can find out the actual space of the files with the command:         
                                                                                
               du -sk //quota.user                                  
               du -sk //quota.group                                 
                                                                                
      NOTE:  Regarding saving and restoring of sparse files:                    
                                                                                
         In my testing, I found that if you "mv", "cp", or "tar" restore        
         a sparse file, the new file will take all the disk blocks shown        
         by the ls command.  For example, ls shows quota.user taking up         
         297 KB, and du shows quota.user taking up 20 KB.  After I              
         "mv", "cp", or "tar" restore quota.user, the du command now            
         shows quota.user taking up 297 KB, instead of 20 KB˘  The              
         "backup" command by name did not exhibit this behavior when            
         restoring a sparse file.  Therefore, if you plan to backup the         
         quota files, I recommend you use the "backup" (by name) and           
         "restore" commands.                                                    
                                                                                
   2) Yes, the edquota command was the only command I could find to add         
      or edit disk quotas.  However edquota with the "-p" flag will allow       
      you to copy one user's disk quotas to another user's.  For example:       
                                                                                
               edquota -p bob user1 user2 user3 user4 ...                       
                                                                                
      will copy bob's disk quotas to user1, user2, user3, user4, etc.           
                                                                                
         I found a way to set the user quota when a new user is being           
      created.  The /etc/security/mkuser.sys file is a script file that         
      is run during the user creation process.  You can add the following       
      line to the end of the mkuser.sys file:                                   
                                                                               
         edquota -p bob $2                                                      
                                                                                
      This will copy bob's disk quota to the new user (kept in variable         
      $2 in this shell script).  Of course, this assumes that bob's             
      disk quota has already been previously set.  User "bob" is                
      considered the template for new user disk quotas in this example.         
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
                                                                                
                                                                                
This item was created from library item Q647183      CMSRF                      
                                                                                
Additional search words:                                                        
CMSRF DASD DISC DISKETTE HARD IX JAN94 LIMITS MANAGEMENT OP OZIBM               
OZNEW QUOTA RISCMGMT RISCSYSTEM SOFT SOFTWARE SYS SYSTEM                       


WWQA: ITEM: RTA000036300 ITEM: RTA000036300
Dated: 03/1996 Category: RISCMGMT
This HTML file was generated 99/06/24~12:43:13
Comments or suggestions? Contact us