Inode quota

Discussion in 'General' started by variable99, Dec 2, 2025 at 2:18 PM.

  1. variable99

    variable99 Active Member HowtoForge Supporter

    Does ISPC support per user inodes quota? Quota system is in place, but file counts set to infinity:

    Code:
    quota -u web297
    Disk quotas for user web297 (uid 1082):
         Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
          /dev/sda1 2291820  5242880 5243904           16006       0       0
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    No. ISPConfig does not set the inode quota.
     
    ahrasis likes this.
  3. variable99

    variable99 Active Member HowtoForge Supporter

    Ok, I have found plugin witch sets quota periodically:

    /usr/local/ispconfig/server/lib/classes/cron.d/100-monitor_hd_quota.inc.php

    There is line:

    Code:
    $app->system->exec_safe('setquota -u ? ? ? 0 0 -a &> /dev/null', $username, $blocks_soft, $blocks_hard);
    It sets 0 0 for inode limit. I guess I should update script by adding inode previous values. The question:

    Where should I modify this code: on master server or on slaves?
     
    ahrasis likes this.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You must modify it on the server where you want to set the quota, which is likely the slave node.
     
    ahrasis and variable99 like this.
  5. variable99

    variable99 Active Member HowtoForge Supporter

    Finally, modified 3 files to get inode functionality. Basically my flow was:
    1. Set inode limits for all users;
    2. Then on quota update cron I read previously set inode limits and re-set it, to avoid reset back to 0;
    Attached 3 files archive from '/usr/local/ispconfig/server/plugins-available' for anyone facing same problem, and maybe for Till to implement inodes support :)

    Code modified/added:
    PHP:
    $inodes $app->system->exec_safe('quota -u ?'$username);
                    
    $lines array_filter(array_map('trim'explode("\n"$inodes)));

                    
    // Skip header lines and find the data line
                    
    foreach ($lines as $line) {
                        
    // Skip lines that are headers or empty
                        
    if (strpos($line'Filesystem') !== false ||
                            
    strpos($line'Disk quotas') !== false) {
                            continue;
                        }
                      
                        
    // Parse the actual quota line
                        
    $parts preg_split('/\s+/'$line);
                      
                        
    // Log for debugging
                        
    $app->log('Quota parts: ' print_r($partstrue), LOGLEVEL_DEBUG);
                      
                        
    // Typical quota output format:
                        // Filesystem  blocks  quota  limit  grace  files  quota  limit  grace
                        // parts[0]    parts[1] parts[2] parts[3] parts[4] parts[5] parts[6] parts[7] parts[8]
                      
                        
    if (count($parts) >= 7) {
                            
    $inode_soft $parts[5];  // Soft limit
                            
    $inode_hard $parts[6];  // Hard limit
                            
    break;
                        }
                    }
                      
                  
    $app->system->exec_safe('setquota -u ? ? ? ? ? -a &> /dev/null'$username$blocks_soft$blocks_hard, isset($inode_soft) ? $inode_soft 0, isset($inode_hard) ? $inode_hard 0);
    P.S. User / group quota not deleted after user removal. A bug of ISPC. Massive number of dormant quota entries.
     

    Attached Files:

    Last edited: Dec 3, 2025 at 7:18 PM
    ahrasis likes this.

Share This Page