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
./configure
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:

mount

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.

[centos-5.2-base]
name=CentOS-5.2 - Base
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates
[centos-5.2-updates]
name=CentOS-5.2 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[centos-5.2-addons]
name=CentOS-5.2 - Addons
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[centos-5.2-extras]
name=CentOS-5.2 - Extras
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centos-5.2-centosplus]
name=CentOS-5.2 - Plus
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

[sipxecs-stable]
name=SIPfoundry sipXecs pbx - latest stable version
baseurl=http://sipxecs.sipfoundry.org/pub/sipXecs/LatestStable/CentOS/5/$basearch/RPM
gpgcheck=0