In linux 2.6 you can also use tmpfs or ramfs .
just mkdir /ramdrive
mount tmpfs /ramdrive -t tmpfs -o size=200M,mode=0777
You can also specify ramfs instead of tmpfs ( i am not sure about difference but from what i have read both use ram for storage ) . After that
edit /etc/fstab
add
tmpfs /ramdisk tmpfs mode=0777,size=200M 0 0
edit /etc/rc.local
mkdir /ramdisk/monitor
mkdir /ramdisk/monitor/ORIG
mkdir /ramdisk/monitor/DONE
end rc.local
make a static directory for holding recordings on hard disk
mkdir /home/voice
mkdir /home/voice/monitor
mkdir /home/voice/monitor/DONE
rm -f /var/spool/asterisk/monitor
ln -s /ramdrive/monitor /var/spool/asterisk/monitor
After that run a script like:
##
perl /usr/share/astguiclient/AST_mix_recordings_BASIC.pl
cd /ramdisk/monitor/ORIG
ls|xargs rm -f
# ( i delete all original files since above script joins files and put them in #DONE folder, ignore this line if you want that )
cd /ramdisk/monitor/DONE
ls|xargs -i mv {} /home/voice/monitor/DONE
##
Run above script every 10 minutes using cron . Also make sure to run the script at server shutdown ( linking in runlevel depending on distribution ) so you wont lose any unmixed files .
I have a few questions :
Is using and formatting /dev/ram0 a better option instead of using tmpfs/ramfs ? By default ubuntu kernel makes ram disk of 65 mb each , i believe this can be changed using kernel parameters . Is above method a proper way of doing this ?