[plug] backup to DVD

Nikhil Jogia plug at nikhiljogia.com
Tue Mar 28 22:16:29 WST 2006


Jon Miller wrote:
> Does anyone know of a script that can backup to a DVD-RW media?  What I would like to do is run a nightly backup of samba shares Mon - Fri and rotate the disk either daily or weekly on the server.  Furthermore, if possible have the backup report the amount of space used in an e-mail sent to the backup operator.
> Would it be better to tar the data and then copy it to DVD or write directly to DVD?
>
> Thanks
>   
Hi,

I do backups daily - I use DVD+RW media as it's supposed to be better 
for data.

Anyway, it is a set of scripts that are run each morning by cron.

The first reads something like this (note the mount.cifs - FC5 doesn't 
have smbmount :(( )

/sbin/mount.cifs \\\\192.168.0.10\\scans /root/scans/ -o 
netbiosname=xxx,guest

if [ "$?" = "0" ]
then
echo "Connected to Front Computer Successfully" | 
/var/qmail/bin/qmail-inject root at localhost
else
echo "Backup could not connect to Front Computer" | 
/var/qmail/bin/qmail-inject root at localhost
fi


2. make the tar.gz file

nice --adjustment=19 tar czf /home/backup.tgz /var/www /var/lib/mysql 
etc etc....


3. make iso image

nice --adjustment=19 mkisofs -quiet -D -U -iso-level 3 -J -o 
/home/xxx.iso /home/backup.tgz


4. burn iso image

umount /media/cdrecorder

dvd+rw-format -force /dev/hdb

exec growisofs -Z /dev/hdb=/home/xxx.iso


5. do the clean up - unmount the smb shares, delete the .tgz and iso files.


6. email user (straight from my crontab) - note also emails qmail stats

46 06 * * * mount /media/cdrecorder
47 06 * * * ls -l /media/cdrecorder > /root/CronJobs/BACKUP/fileoutput
48 06 * * * /etc/init.d/qmail stat >> /root/CronJobs/BACKUP/fileoutput
49 06 * * * /usr/local/bin/php /root/CronJobs/BACKUP/mail.php 2> 
/dev/null 1> /dev/null
50 06 * * * echo "" > /root/CronJobs/BACKUP/fileoutput
51 06 * * * umount /media/cdrecorder

There are other, simpler ways of doing this, but this way has worked 
perfectly for a few years now.

The main program you need to use is growisofs, which can take plain old 
directories and files as arguments (ie - you dont need an iso file).





More information about the plug mailing list