Tuesday, December 29, 2009

Mount USB Key for sipXecs Backups

Ok, so you don't want to bother setting up an FTP server to store backups of your sipXecs system. Here's how to mount a USB Key to your backup folder.

Most USB keys will setup SCSI drive device (in my case it was /dev/sda1). Plug in a USB key and check out the /var/log/messages file to see what device was created.

You'll want to get a little program installed on your system called 'scsiadd'. This allows you to remove USB scsi devices from the system without causing them damage. It's available here: http://llg.cubic.org/tools/

The following assumes you are logged into the system as root...

Add required packages:
yum install lsscsi

If you don't have development tools on your sipXecs system yet, add them:
yum install gcc gcc-c++ kernel-devel

Download, build and install scsiadd:
cd $HOME
mkdir scsiadd
cd scsiadd
wget http://llg.cubic.org/tools/scsiadd-1.97.tar.gz
tar -xf scsiadd-1.97.tar.gz
cd scsiadd-1.97
make install

Command line options:

scsiadd 1.97 - add and remove devices from the scsi subsystem
syntax: scsiadd {-a|-r}
scsiadd {-a|-r}
scsiadd {-a|-r}
scsiadd {-a|-r}
scsiadd [-i maxid] -s
scsiadd [-i maxid] -s
scsiadd -p
parameters not given are assumed 0
-a: add a device (default if no command given)
-r: remove device
-s: scan for devices
-p: print scsi status
-h: print this help message
-i: maximum SCSI ID which is scanned

Here's a good blog article on using scsiadd: http://blog.shadypixel.com/safely-removing-external-drives-in-linux/

Essentially, to remove a scsi device while the system is running, first find the device with lsscsi and then use scsiadd -r to remove it...

[root@sipx scsiadd-1.97]# lsscsi
[3:0:0:0] disk CBM USB 2.0 5.00 /dev/sdb
[root@sipx scsiadd-1.97]# scsiadd -r 3
could not remove device 0 0 3 0 : No such device or address
[root@sipx scsiadd-1.97]# scsiadd -r 3 0 0 0
[root@sipx scsiadd-1.97]#

Ok, now let's get to making the USB work:

Convert your USB drive from FAT16 or whatever it is to ext3:

mkfs.ext3 /dev/sda1

Modify /etc/fstab:

nano -w /etc/fstab

Add the following line at the bottom:

/dev/sda1 /var/sipxdata/backup vfat auto,user,rw,sync 0 0

Test your fstab file now:

mount -a

And check to see that it is mounted:


Change ownership on backup folder:

chown -R sipxchange:sipxchange /var/sipxdata/backup

Perform a test backup from the GUI.

Monday, December 28, 2009

How to fix the yum repos file for sipXecs 4.0.4

Edit the /etc/yum.repos.d/sipxecs.repo

nano -w /etc/yum.repos.d/sipxecs.repo

on all the lines that begin with mirrorlist and baseurl change the 5.2 to be just 5.

Here's the resulting sipxecs.repo file.

name=CentOS-5.2 - Base

#released updates
name=CentOS-5.2 - Updates

#packages used/produced in the build but not released
name=CentOS-5.2 - Addons

#additional packages that may be useful
name=CentOS-5.2 - Extras

#additional packages that extend functionality of existing packages
name=CentOS-5.2 - Plus

name=SIPfoundry sipXecs pbx - latest stable version