The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

/etc/quota.conf empty

Discussion in 'General Discussion' started by blargman, Nov 1, 2007.

  1. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    All the quotas are unlimited. I've tried fixquotas/iniquotas. I found a thread on how to do resetquotas, but its failing as the /etc/quota.conf is empty.

    How can i repopulate quota.conf? I tried rpm -e quota and reinstalling.
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Are quotas enabled for the drive on which accounts exist?
     
  3. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    yes sir, I tried quotaon and quotaoff as it was suggested in a forum post i found.
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    If the quotas are working but you simply have an empty /etc/quota.conf file, then I wrote the following script a while ago to repopulate it with the Package defaults so save you having to reassign them all by hand:
    Code:
    #!/usr/bin/perl
    opendir (DIR, "/var/cpanel/packages");
    while (my $file = readdir (DIR)) {
    	if ($file !~ /^\./) {
    		open (IN, "</var/cpanel/packages/$file");
    		my @data = <IN>;
    		close (IN);
    		chomp @data;
    
    		foreach my $line (@data) {
    			if ($line =~ /^QUOTA=(.*)$/) {
    				$package{$file} = $1;
    				last;
    			}
    		}
    	}
    }
    closedir (DIR);
    $package{undefined} = 0;
    
    opendir (DIR, "/var/cpanel/users");
    while (my $user = readdir (DIR)) {
    	if ($user !~ /^\./) {
    		open (IN, "</var/cpanel/users/$user");
    		my @data = <IN>;
    		close (IN);
    		chomp @data;
    
    		foreach my $line (@data) {
    			if ($line =~ /^PLAN=(.*)$/) {
    				open (OUT, ">>/etc/quota.conf");
    				print OUT "$user=$package{$1}\n";
    				close (OUT);
    				last;
    			}
    		}
    	}
    }
    closedir (DIR);
    
     
  5. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    awesome, thanks a ton chirpy, worked perfectly. ran fixquotas afterwards and everything is back to normal!
     
Loading...

Share This Page