Setting up RAM Drive

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Setting up RAM Drive

Postby gerski » Tue Feb 26, 2008 9:44 pm

Guys, Have you tried installing RAM DRIVE? how can it help recordings to process? We are planning to buy one like this:

http://techreport.com/articles.x/9312

Thanks...
http://www.perfectnetworkcorp.com
Perfect Network Corporation
gerski
 
Posts: 432
Joined: Fri Jul 14, 2006 6:21 am

Postby mflorell » Wed Feb 27, 2008 12:05 am

I've just used system RAM for a RAM drive in Linux, very easy to set up and it reduced load and hard drive fragmentation tremendously.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby DarknessBBB » Wed Feb 27, 2008 8:14 am

mflorell wrote:I've just used system RAM for a RAM drive in Linux, very easy to set up and it reduced load and hard drive fragmentation tremendously.


Hello Matt, where can I find documentation about setting up a ram drive using linux system ram? :oops:
Do I need a cron script that transfers recordings every n minutes from ramdrive to HD?
DarknessBBB
 
Posts: 328
Joined: Mon Jul 16, 2007 10:14 am

Postby mflorell » Wed Feb 27, 2008 9:20 am

The info is right in the scratch install doc:
http://astguiclient.sourceforge.net/scr ... stall.html

First you need to set kernel options for a RAM drive when building your Linux Kernel:
Device Drivers --->
Block devices --->
<*> Loopback device support
<*> RAM disk support
(1) Default number of RAM disks
(512000) Default RAM disk size (kbytes)
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
(ONLY USE THE ABOVE 4 SETTINGS IF YOU WILL BE SETTING UP A RAM DRIVE FOR RECORDING)

Then you need to activare the RAM drive upon boot(/etc/rc.d/rc.local):
### uncomment If kernel RAM drive is enabled
# mke2fs -m 0 /dev/ram0
# mount /dev/ram0 /var/spool/asterisk/monitor
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby aster1 » Fri Mar 07, 2008 2:47 am

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 ? :oops:
aster1
 
Posts: 281
Joined: Sun Dec 24, 2006 6:48 am
Location: India

Postby mflorell » Sat Mar 08, 2008 12:10 am

I have always had very good results using the instructions I posted in the scratch install doc. There are several ways to set up RAM drives, but that way is most universal for even older systems and seems to not have any downsides.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby pylinuxian » Mon Mar 17, 2008 2:15 pm

pylinuxian
 
Posts: 147
Joined: Tue Feb 26, 2008 2:21 pm

Postby pylinuxian » Mon Mar 17, 2008 2:51 pm

in /boot/grub/grub.conf add ramdisk_size=66000
so that it should look like this :

kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/1 ramdisk_size=1000000



in /etc/rc.d/rc.local : add or uncomment this :

### start ram drive for recordings
#/sbin/mke2fs -m 0 /dev/ram0
#/bin/mount /dev/ram0 /var/spool/asterisk/monitor
#/bin/mkdir /var/spool/asterisk/monitor/DONE
#/bin/mkdir /var/spool/asterisk/monitor/ORIG

beware you ll have to copy the files to an nfs drive every time the ram drive is full & before any reboot.
pylinuxian
 
Posts: 147
Joined: Tue Feb 26, 2008 2:21 pm

Postby Op3r » Thu Jun 19, 2008 1:22 pm

now the main question is how do you transfer it every 10 minutes or so?
Get paid for US outbound Toll Free calls. PM me.
Op3r
 
Posts: 1432
Joined: Wed Jun 07, 2006 7:53 pm
Location: Manila

Postby mflorell » Thu Jun 19, 2008 7:11 pm

On some higher-load systems we will use tmpfs and run transfers of recordings every 1-3 minutes.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby Op3r » Thu Jun 19, 2008 7:17 pm

matt

do you have a script to transfer the said recordings from DONE to any directory?

Im actually bashing my head as I am actually ftp'ing it to localhost but most of the time the script wont work as I am using 2.0.3 (as they dont want to upgrade cos they said if it is not broken dont fix it)

:(
Get paid for US outbound Toll Free calls. PM me.
Op3r
 
Posts: 1432
Joined: Wed Jun 07, 2006 7:53 pm
Location: Manila

Postby gardo » Thu Jun 19, 2008 10:29 pm

Here's a simple bash script to do it:

#!/bin/sh

cd /var/spool/asterisk/monitor/DONE/
for X in *.gsm
do
mv $X /directory/of/choice
done


Put it in your crontab and run every 10 mins or so. You might also want to integrate "nice" to it so it runs with a lower priority.
http://goautodial.com
Empowering the next generation contact centers
gardo
 
Posts: 1926
Joined: Fri Sep 15, 2006 10:24 am
Location: Manila, 1004

Postby Op3r » Fri Jun 20, 2008 7:07 am

ok I give up

can I just do this?

exten => 8309,1,Answer
exten => 8309,2,MixMonitor(${CALLERIDNAME}.gsm||/root/move_file.sh ${CALLERIDNAME}.gsm)
exten => 8309,3,Wait,3600
exten => 8309,4,Hangup

it will mixmonitor it then the file move_file.sh will be called

this is what on the move_file.sh

#!/bin/sh

cd /var/spool/asterisk/monitor
for X in $1
do
mv $1 /home/recordings
done


so that it will transfer to the hard drive. will this affects anything except the load?
Get paid for US outbound Toll Free calls. PM me.
Op3r
 
Posts: 1432
Joined: Wed Jun 07, 2006 7:53 pm
Location: Manila

Postby Op3r » Fri Jun 20, 2008 7:44 am

here's another step im trying

I tried the AST_CRON_mix_recordings_GSM.pl from 2.0.4 to 2.0.3

I guess it was ok but then I get this error

a.gsm': No such file or directory
Net::FTP>>> Net::FTP(2.77)
Net::FTP>>> Exporter(5.58)
Net::FTP>>> Net::Cmd(2.29)
Net::FTP>>> IO::Socket::INET(1.29)
Net::FTP>>> IO::Socket(1.29)
Net::FTP>>> IO::Handle(1.25)
Net::FTP=GLOB(0x8aad2e4)<<< 220 (vsFTPd 2.0.5)
Net::FTP=GLOB(0x8aad2e4)>>> USER recordings
Net::FTP=GLOB(0x8aad2e4)<<< 331 Please specify the password.
Net::FTP=GLOB(0x8aad2e4)>>> PASS ....
Net::FTP=GLOB(0x8aad2e4)<<< 230 Login successful.
Net::FTP=GLOB(0x8aad2e4)>>> CWD RECORDINGS
Net::FTP=GLOB(0x8aad2e4)<<< 550 Failed to change directory.
Net::FTP=GLOB(0x8aad2e4)>>> TYPE I
Net::FTP=GLOB(0x8aad2e4)<<< 200 Switching to Binary mode.
Cannot open Local file /20080620-053339_7920803185_UK_rea.gsm: No such file or directory
at ./AST_CRON_mix_recordings_GSM.pl line 193
Net::FTP=GLOB(0x8aad2e4)>>> QUIT
Net::FTP=GLOB(0x8aad2e4)<<< 221 Goodbye.
mv: cannot move `/var/spool/asterisk/monitor/20080620-053431_2084710327_UK_rea.gsm' to `/ORIG/20080620-053431_2084710327_UK_rea.gsm': No such file or directory
mv: cannot move `/var/spool/asterisk/monitor/20080620-053431_2084710327_UK_rea.gsm' to `/ORIG/20080620-053431_2084710327_UK_rea.gsm': No such file or directory
Net::FTP=GLOB(0x8ad626c)<<< 220 (vsFTPd 2.0.5)
Net::FTP=GLOB(0x8ad626c)>>> USER recordings
Net::FTP=GLOB(0x8ad626c)<<< 331 Please specify the password.
Net::FTP=GLOB(0x8ad626c)>>> PASS ....
Net::FTP=GLOB(0x8ad626c)<<< 230 Login successful.
Net::FTP=GLOB(0x8ad626c)>>> CWD RECORDINGS
Net::FTP=GLOB(0x8ad626c)<<< 550 Failed to change directory.
Net::FTP=GLOB(0x8ad626c)>>> TYPE I
Net::FTP=GLOB(0x8ad626c)<<< 200 Switching to Binary mode.
Cannot open Local file /20080620-053431_2084710327_UK_rea.gsm: No such file or directory
at ./AST_CRON_mix_recordings_GSM.pl line 193
Net::FTP=GLOB(0x8ad626c)>>> QUIT
Net::FTP=GLOB(0x8ad626c)<<< 221 Goodbye.


any hints?
Get paid for US outbound Toll Free calls. PM me.
Op3r
 
Posts: 1432
Joined: Wed Jun 07, 2006 7:53 pm
Location: Manila

hello

Postby eliasferreyra » Fri Jun 20, 2008 12:24 pm

i thisnk thats in slackware

how can i do a ramdrive on centos?

does anybody have any document
eliasferreyra
 
Posts: 367
Joined: Wed Jul 18, 2007 3:27 pm

Postby pylinuxian » Fri Jun 20, 2008 1:14 pm

i thisnk thats in slackware
how can i do a ramdrive on centos?
does anybody have any document


its a kernel thing not a disto one. so it applies to everywhere.

this was on a CentOS machine.

in /boot/grub/grub.conf add ramdisk_size=1000000
so that it should look like this :

kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/1 ramdisk_size=1000000
in /etc/rc.d/rc.local : add or uncomment this :
### start ram drive for recordings
#/sbin/mke2fs -m 0 /dev/ram0
#/bin/mount /dev/ram0 /var/spool/asterisk/monitor
#/bin/mkdir /var/spool/asterisk/monitor/DONE
#/bin/mkdir /var/spool/asterisk/monitor/ORIG

beware you ll have to copy the files to an nfs drive every time the ram drive is full & before any reboot.
pylinuxian
 
Posts: 147
Joined: Tue Feb 26, 2008 2:21 pm

Postby pylinuxian » Fri Jun 20, 2008 1:19 pm

Net::FTP=GLOB(0x8aad2e4)<<< 550 Failed to change directory.


wrong directory name, missing directory or wrong permissions.
so check vsftpd.log on host machine.
pylinuxian
 
Posts: 147
Joined: Tue Feb 26, 2008 2:21 pm

Postby Op3r » Sat Jun 21, 2008 1:47 am

I saw the mistake, I have a wrong ftp directory on the astguiclient.conf as the new recording scripts takes a look at that file.

and Im gonna still try to ftp the recordings later.
Get paid for US outbound Toll Free calls. PM me.
Op3r
 
Posts: 1432
Joined: Wed Jun 07, 2006 7:53 pm
Location: Manila

Postby codehaxor » Sat Jun 21, 2008 2:33 am

so is it ok to have a 2GB RAM drive and just use the mp3.pl script in the crontab to upload files to a local ftp server once in a while?
codehaxor
 
Posts: 151
Joined: Wed Mar 14, 2007 2:37 am
Location: Dumaguete City, Philippines

Postby pylinuxian » Sat Jun 21, 2008 4:19 am

so is it ok to have a 2GB RAM drive and just use the mp3.pl script in the crontab to upload files to a local ftp server once in a while?


With two Gigs ... I guess you could wait untill agents are in pause time ;) that way you stay light on the server but yes you can do it.

I would also avoid compressing the recordings on the dialer itself, I would do it on ftp host instead.
pylinuxian
 
Posts: 147
Joined: Tue Feb 26, 2008 2:21 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 136 guests