TIPS Disk almost full. Where to clean out files?

Discussion in 'PBX in a Flash 5' started by RoboLord, Mar 15, 2019 at 8:48 PM.

  1. RoboLord

    RoboLord Member

    Joined:
    Aug 18, 2017
    Messages:
    41
    Likes Received:
    3
    I have a 13-13 install on CentOS 6.9, running inside a Proxmox container. This one is used exclusively as a fax machine with Incredible Fax. I had 5 months of uptime without a single hiccup, then yesterday the PBX stopped answering calls.

    I checked in the Hylafax front end and deleted a ton of old faxes. I rebooted and it worked for most of today then went down again. I just went into an SSH session and ran 'df' and found that /dev/sda2 is running at 88% full and /dev/sda1 is running 70% full.

    I'm not sure if this would be enough to crash the system, however I'm guessing it wouldn't hurt to go in and prune some log files and whatnot. Anyone have a suggestion on where to look for some low hanging fruit to clean up on these volumes? Thanks!
     
  2. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,612
    Likes Received:
    2,489
    Good places to start:

    /var/log
    /var/log/asterisk
     
  3. ostridge

    ostridge Guru

    Joined:
    Jan 22, 2015
    Messages:
    372
    Likes Received:
    66
    I remembered a script here somewhere that purges files created by call monitor;and which also are HDD killers. So I did a search for 'purge recordings' which throws up 4 posts here

    Maybe when you know where your faxes are stored; that script could perhaps be a start point for a similar script for faxes?
     
    #3 ostridge, Mar 16, 2019 at 8:29 PM
    Last edited: Mar 16, 2019 at 8:43 PM
  4. dicko

    dicko Still learning but earning

    Joined:
    Oct 30, 2015
    Messages:
    582
    Likes Received:
    210
    Faxes are stored in two places, hylafax keeps the ps in /var/spool/hylafax/*q

    Avantfax keeps the pdf's in your web servers'documentroot/avantfax/faxes

    A GUI thing, install ncdu and

    ncdu /
     
    #4 dicko, Mar 16, 2019 at 11:33 PM
    Last edited: Mar 16, 2019 at 11:38 PM
    wardmundy likes this.
  5. krzykat

    krzykat Guru

    Joined:
    Aug 2, 2008
    Messages:
    1,406
    Likes Received:
    348
    We've added this to our routines that allows you to record all calls if you want, but still not run out of disk space, just purging the oldest audio recordings:

    To crontab add:

    # Purge Audio Recordings along with empty directories
    5 5 * * * root /etc/purgeVCDR

    runs daily at 5:05 am ... tweak to your liking

    create a file in /etc/ called purgeVCDR - make sure its executable:

    Code:
    #!/bin/bash
    
    
    while (( `df /|/usr/bin/tail -1|/usr/bin/awk '{print $5'}|/bin/sed 's/\%//'` > 90 ))
    do
    /bin/rm -f `/bin/find /var/spool/asterisk/monitor/ -name "*.wav" -ls | /usr/bin/awk '{print $11'} | sort -n | /usr/bin/head -n 1`
    cmd=$(/bin/find /var/spool/asterisk/monitor/ -name "*.wav" -ls | /usr/bin/awk '{print $11'} | sort -n | /usr/bin/head -n 1)
      if [ -z "$cmd" ]; then
        exit
      fi
    done
    
    find /var/spool/asterisk/monitor/ -empty -type d -delete
    Note: Code is set to have at max 90% usage - tweak as desired.
     
    wardmundy likes this.