Sqlite.db ~10G. Can I shrink it w/o breaking asterisk?

sqlite.db and other CDR dbs taking too much space.

#checkspace 
22735   /var/
12179   /var/lib
9318    /var/lib/asterisk
9099    /var/lib/asterisk/sqlite.db
6727    /var/log
6676    /var/log/asterisk
3332    /var/log/asterisk/cdr.db
2022    /var/spool/asterisk
2022    /var/spool
1852    /var/log/asterisk/cdr-csv/Master.csv
1852    /var/log/asterisk/cdr-csv
1539    /var/lib/mysql
1512    /var/lib/mysql/asteriskcdrdb
1498    /var/spool/asterisk/monitor
1313    /var/lib/mysql/asteriskcdrdb/cdr.MYD

Looks like all are being used for CDR. I read on other forums that only mysql should be used for CDRs.

#ls -alh /var/lib/asterisk/sqlite.db 
-rw-rw-r-- 1 asterisk asterisk 8.9G 2016-10-12 20:21 /var/lib/asterisk/sqlite.db
#ls -alh /var/log/asterisk/cdr.db 
-rw-rw-r-- 1 asterisk asterisk 3.3G 2016-10-12 20:21 /var/log/asterisk/cdr.db
#ls -alh /var/lib/mysql/asteriskcdrdb/cdr.MYD
-rw-rw---- 1 mysql mysql 1.3G 2016-10-12 20:24 /var/lib/mysql/asteriskcdrdb/cdr.MYD

I am running:
FreePBX 2.10
Asterisk 1.8

I compiled Asterisk before installing FreePBX on top of it.

The system has been running w/o any issues since 2011 but /var is filling up now. How I can reclaim this space?

I’m not really sure what’s in the sqlite.db - You’ll have to investigate that for yourself. That’s not something FreePBX does.

You can simply truncate your cdr table, if you want - ‘mysql asteriskcdrdb’ and then ‘truncate cdr’

The ‘cdr.db’ file is probably safe to delete, as asterisk should (I believe) recreate it. Probably best to just rename it, and then restart asterisk and see what happens.

Thanks Rob.

Does this help?

/etc/asterisk/res_config_sqlite.conf
[general]

; The database file.
dbfile => /var/lib/asterisk/sqlite.db

; Both config_table and cdr_table are optional. If config_table is omitted,
; you must specify it in extconfig.conf. If it is both provided here and in
; extconfig.conf, the value given here is used. If cdr_table is omitted, CDR
; support is simply disabled.
config_table => ast_config
cdr_table => ast_cdr
~