How to backup to disk using flexbackup on e-smith  
e-smith release:  4.1.x

Author:  Des Dougan (ddougan@telus.net)  
Contributor:
  Darrell May

Release: 0.2, 23 September 2001

Acknowledgements: 
Customizing flexbackup within the e-smith template system was suggested to me by Darrell May, after I'd gone down a separate route. Darrell's solution, contained herein, is more elegant and e-smith-compliant.

Summary:
This document explains how to use flexbackup and the e-smith manager to run a scheduled backup to a disk drive on a client workstation. It has been tested with version 4.1.2 and should work with versions 4.1.1 and 4.1.

Introduction:
I run e-smith on my small home LAN. Currently, I'm without a tape drive but wanted to backup my server to a spare disk on my desktop PC. This How-To does this using existing e-smith features, in part customized via the template system.


Creating a filesystem share on the desktop (Windows) PC

In Explorer, create the directory you want to backup to. Select it, right click and select the "Sharing" option. Create a share name of "Backup". Make sure it is writable by all (this is dependent on your Windows OS. In Win2K, this is done from the "Permissions" dialog on the "Sharing" tab).  The default settings should be OK here.

Setting up the mount and fstab

The Linux convention is to mount removable media from /mnt. Create a directory called /mnt/backup to act as mount point for the share created previously. Using your favourite editor, add an entry to /etc/fstab for the share:

[root@e-smith]# pico /etc/fstab

//servername/sharename  /mnt/backup  smbfs  username=name,password=pword

where "servername" and "sharename" are the name of the PC and the share you created previously. /mnt/backup identifies the mount point, while  the username and password pair are the userid and password used to logon to the PC (required for NT and Win2K systems). smbfs denotes the mount as using the smb file system.

Configuring the flexbackup template: /sbin/e-smith/backup

The standard e-smith backup routines, configured via the manager, are run from /sbin/e-smith/backup. As is the e-smith way, this script is built from template fragments held in the directory /etc/e-smith/templates/sbin/e-smith/backup. The following steps must be followed to customize it for our purposes:

1. Having logged into the server as root, type the following commands:

[root@e-smith]# mkdir -p /etc/e-smith/templates-custom/sbin/e-smith/backup
[root@e-smith]# cd /etc/e-smith/templates-custom/sbin/e-smith/backup

2. Create two blank fragments:

[root@e-smith]# touch 20probe-tape
[root@e-smith]# touch 90rewind-tape

3. Create two new fragments:

[root@e-smith]# echo mount /mnt/backup > 25mount-share
[root@e-smith]# echo umount /mnt/backup > 95umount-share

The template then needs to be expanded to create the new version of the backup script:

[root@e-smith]# /sbin/e-smith/expand-template /sbin/e-smith/backup

Configuring the flexbackup template: /etc/cron.d/backup

The standard e-smith backup cron entry, /etc/cron.d/backup is built from a single template fragment held in the directory /etc/e-smith/templates/etc/cron.d/backup. The following steps must be followed to customize it for our purposes:

1. Having logged into the server as root, type the following commands:

[root@e-smith]# mkdir -p /etc/e-smith/templates-custom/etc/cron.d/backup
[root@e-smith]# cd /etc/e-smith/templates-custom/etc/cron.d/backup
[root@e-smith]# cp /etc/e-smith/templates/etc/cron.d/backup .  

2. Edit the fragment:

[root@e-smith]# pico /etc/e-smith/templates-custom/etc/cron.d/backup/backup

Look for this section:

$OUT .= 
"$reminderMin $reminderHour * * * root"
. " /bin/mt -f $device tell > /dev/null 2>&1 ||" 
. " echo 'Remember to load the backup tape!'\n" 
. "$backupMin $backupHour * * * root" 
. " /sbin/e-smith/backup"

Edit to this:

$OUT .= 
"$backupMin $backupHour * * * root" 
. " /sbin/e-smith/backup"

If you do NOT want to run your backup daily, you should edit the above command line further.  See 'man cron' for details.

Configuring flexbackup to write to disk

Flexbackup can be configured to backup to a disk by simply changing the "$device" variable in /etc/flexbackup.conf via the e-smith way by entering:

[root@e-smith]# /sbin/e-smith/db configuration setprop backup Device /mnt/backup
[root@e-smith]# /sbin/e-smith/signal-event conf-backup

Enable backups in the e-smith manager

In the Administration section of the manager, select "Backup or restore", then select the "Configure tape backup" action. Check the "Enable tape backup" box and the time for both the backup and reminder selections. Hit the "Update Configuration" button.  This will expand the template and create the new /etc/cron.d/backup entry. That's it! Done, finished, complete.

Summary

This procedure provides an e-smith standard way of backing up to disk. However, as Darrell May has pointed out, its strength lies in its flexibility when restoring, as the power of flexbackup is available to you. Good luck!