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.

/scripts/securetmp and /usr/tmpDSK capped at 4GB /tmp

Discussion in 'General Discussion' started by eva2000, Oct 11, 2012.

  1. eva2000

    eva2000 Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    322
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Brisbane, Australia
    cPanel Access Level:
    Root Administrator
    Twitter:
    Curious is there any reason /scripts/securetmp caps size of /usr/tmpDSK to 4GB when $tmpdsksize is greater than 4GB ?

    I have 42GB free diskspace for /usr partition and it wouldn't let me set 8G for $tmpdsksize due to the code. Guess I just need to change $FOUR_GIG_k value to work around it. But just curious why it's coded this way ?

    Code:
    # Begin securetmp actions
    if ( !$tmpmnt ) {
    
        print "Calculating size on /tmp\n";
        my $partition_map = {};
        my $filesys       = Cpanel::DiskLib::get_disk_used_percentage_with_dupedevs();
        foreach my $disk ( @{$filesys} ) {
            $partition_map->{ $disk->{'mount'} } = $disk->{'available'};
        }
        my $mount_point = Cpanel::Filesys::find_mount( $filesys, '/usr/tmpDSK' );
    
        my $available                = $partition_map->{$mount_point};
        my $one_percent_of_available = ( $available * 0.01 );
        if ( $one_percent_of_available > $tmpdsksize ) {
            $tmpdsksize = $one_percent_of_available;
        }
        my $FOUR_GIG_k = ( 1024 * 1024 * 4 );
        if ( $tmpdsksize > $FOUR_GIG_k ) {
            $tmpdsksize = $FOUR_GIG_k;
        }
    
        $tmpdsksize = int($tmpdsksize);
        $tmpdsksize = $tmpdsksize - ( $tmpdsksize % 1024 );
    
        my $tmpdsksize_megs = ( $tmpdsksize / 1024 );
        print "/tmp calculated to be $tmpdsksize_megs M based on available disk space in /usr\n";
     
    #1 eva2000, Oct 11, 2012
    Last edited: Oct 11, 2012
  2. DestoMedia

    DestoMedia Member

    Joined:
    Jul 12, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    We're running into the same issue, why is it capped and can we just change the $FOUR_GIG_K value as work around?
     
Loading...

Share This Page