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

eva2000

Well-Known Member
Aug 14, 2001
346
19
318
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";
 
Last edited:

DestoMedia

Member
Jul 12, 2007
8
0
51
We're running into the same issue, why is it capped and can we just change the $FOUR_GIG_K value as work around?