Difference between revisions of "Free hard disk space"
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
du -k | sort -n | perl -ne 'if ( /(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}' | du -k | sort -n | perl -ne 'if ( /(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}' | ||
If you find that most space is taken by /var/lib/mysql/mor/calls.idb, it | If you find that most space is taken by /var/lib/mysql/mor/calls.idb, it means that most space is used by CDRs. Solution is to start using [[Archived calls]] functionality with option to export to TGZ files or with option to delete old CDRs instead of archiving them. Please note that some extra space will be needed to create TGZ archives. | ||
==Workflow== | ==Workflow== | ||
Line 23: | Line 23: | ||
5. MOR GUI logs: | 5. MOR GUI logs: | ||
cd /home/mor/log | cd /home/mor/log | ||
6. Size of /var/lib/elasticsearch/ can be reduced by using [[Archived calls]]. | |||
==What to do if free space not recovered after deleting the file== | ==What to do if free space not recovered after deleting the file== |
Latest revision as of 10:24, 27 March 2017
Check disk usage
To check how many free space is available on your server put this command into terminal:
df -h
Put this command into terminal to check biggest files in system:
du -k | sort -n | perl -ne 'if ( /(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'
If you find that most space is taken by /var/lib/mysql/mor/calls.idb, it means that most space is used by CDRs. Solution is to start using Archived calls functionality with option to export to TGZ files or with option to delete old CDRs instead of archiving them. Please note that some extra space will be needed to create TGZ archives.
Workflow
Possible location on system created by mor which can use a lot of space:
1. Recordings files are stored in this directory:
cd /var/spool/asterisk/monitor
2. Log files are stored:
/tmp/mor/debug
3. Here are stored backups made from MOR GUI.
cd /usr/local/mor/backups
It is recommended to keep on server 3 backups
Do not allow to create backup when disk space is less when 10%
4. CSV files are stored here:
cd /var/log/asterisk/cdr-csv/
5. MOR GUI logs:
cd /home/mor/log
6. Size of /var/lib/elasticsearch/ can be reduced by using Archived calls.
What to do if free space not recovered after deleting the file
It might happen if file was opened at the moment you deleted it. Solution is to find that service and restart it.
To find service which keeps file opened:
# lsof +L1 | grep deleted mysqld_sa 1798 root txt REG 253,0 938736 0 37397 /bin/bash (deleted) safe_aste 3349 root txt REG 253,0 938736 0 37397 /bin/bash (deleted) asterisk 3354 root 12w REG 253,0 31431421481 0 669511 /var/log/asterisk/messages (deleted)
This output example shows that /var/log/asterisk/messages was deleted, but still in use by "asterisk" and taking 31431421481 bytes (almost 30GB).
To restart that service:
services asterisk restart