[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cdrecord/README.ATAPI boot camp



Dan Jacobson <jidanni@dman.ddts.net> writes:

> Just thought you might like to see how I append files to my CDs, a
> multitrack backup CD.  My hair is turning grey in no coincidence to
> the trial and error involved.  I step thru it and it actually works.
> You know what's neat?  How the windows users just pop in the disks
> like on the Nero screen, whilst us Linux Debian users get
> /usr/share/doc/cdrecord/README.ATAPI.gz boot camp, if indeed we still
> have the 'cells to comprehend it.

Just use xcdroast.
 
> #Makefile:
> sec=/home/jidanni/tmp/first_dir/second_dir
> a19copy: #must be root
> 	-rm $(sec)/*
> 	find /var/tmp/*bkp*.bz2 -mtime -1 -print -exec cp -p {} $(sec) \;
>         #cp a cpio backup into the empty 'second dir', then

I suggest using afio. It compresses single files, not the whole archive,
which makes the backups less vulnerable. It is compatibel with cpio.

> insmod: #2002.7 must have disk in recorder
> 	insmod ide-scsi #debian, else bananas. in lilo.conf I appended stuff too

I would compile this into the kernel (not as module).
 
> debdev=0,0,0
> a19: #must have disk in recorder, silly me
> 	-mount /cdrom
> 	set -x;Z=`cdrecord -msinfo dev=$(debdev)` && \
> 	mkisofs -v -o ../tmp/isoimage_2.raw -r -C $$Z -M /dev/cdrom.. /tmp/first_dir

You do not need to mount a disk to used it with cdrecord and mkisofs.
What do you do with a blank disc?

,----[ mount /cdrw ]
| mount: wrong fs type, bad option, bad superblock on /dev/cdrw,
|        or too many mounted file systems
`----

,----[ cdrecord dev=0,0,0 -msinfo ]
| cdrecord: Input/output error. read toc: scsi sendcmd: no error
| CDB:  43 00 01 00 00 00 00 00 04 00
| status: 0x2 (CHECK CONDITION)
| Sense Bytes: 70 00 05 00 00 00 00 0C 00 00 00 00 24 00 00 00
| Sense Key: 0x5 Illegal Request, Segment 0
| Sense Code: 0x24 Qual 0x00 (invalid field in cdb) Fru 0x0
| Sense flags: Blk 0 (not valid) 
| cmd finished after 0.003s timeout 40s
| cdrecord: Cannot read session offset
`----

> a19d:
> 	-mount /cdrom #I forgot if needed
> 	#needed fs=4m otherwise it can't read it out of the default file
> 	cdrecord fs=4m -dummy -v -multi ../tmp/isoimage_2.raw

Where is dev=0,0,0?

,----[ cdrecord fs=4m -dummy -v -multi ~/../image-dir/Backup_31_08_2002.iso ]
| cdrecord: No CD/DVD-Recorder device specified.
| Usage: cdrecord [options] track1...trackn
| 
| Use	cdrecord -help
| to get a list of valid options.
| 
| Use	cdrecord blank=help
| to get a list of valid blanking options.
`----

> ##did you make room infront of the computer as the disk will get
> #ejected (a male thing, else no guarantee of success) after this:
> #also don't do any other stuff at the same time to slow this down!
> a19w:
> #Must unmount first otherwise it will think it is read only no matter
> #what you do in fstab or -o rw etc.  Also you will think you burned ok
> #but it didn't burn at all
> 	-umount /cdrom
> 	#needed fs=4m otherwise it can't read it out of the default file
> 	cdrecord fs=4m -v -multi -eject ../tmp/isoimage_2.raw

See above.

I use this for my personal box, saved my ass a couple of times. Comments
and suggestions apreciated:

,----[ less ~/Skripte/backup.sh ]
| #!/bin/bash
| # -*- mode: Shell-script -*-
| #-------------------------------------------------------------------------------
| #
| # Create afio backups of specific directorys, create a cd image file of those 
| # backups and write them to a multi session cd.
| #
| # You need: sudo, afio, gzip, tr, mkisofs, cdrecord and a brain. A CD should be 
| #           placed in the writer prior to execution of this script.           
| #
| #-------------------------------------------------------------------------------
| Backup_Dir=/home/Backup
| Image_Dir=/home/image-dir
| CD_Dir=Backup_`date +%d_%m_%Y`
| Image_Name=${Image_Dir}/${CD_Dir}.iso
| 
| #-------------------------------------------------------------------------------
| # Create an afio backup of directory given in $1 with file name $Backup_Name.
| backup_dir()
| {
|     if [ -d $1 ]; then
| 	echo "-> Backup of directory: $1"
| 	echo -n "   "
| 
| 	Backup_Name=${Backup_Dir}/`echo -n $1 | tr // _`_`date +%d_%m_%Y`.afio
| 	sudo find $1 | sudo afio -o -x -z -A -G 9 -Z $Backup_Name
| 
| 	if [ $? != 0 ]; then
| 	    echo
| 	    echo "-> ** Aborting **"
| 	    exit 1
| 	fi
|     else
| 	echo
| 	echo "-> $1 does not exist!"
| 	echo "-> ** Aborting **"
| 	exit 1
|     fi
| }
| 
| #-------------------------------------------------------------------------------
| # Creates a RockRidge/Joliet cd image file that can either be the first track
| # of a multi session cd or be appended to a multi session cd. The files are 
| # taken from $Backup_Dir. All files with extension .afio will be placed in the
| # image relative to $CD_Dir. The image file will be placed in $Image_Dir with
| # name $Image_Name.
| make_image()
| {
|     echo -n "Is this to be the first multi session track on this disk? [y/n]: "
|     read ans
| 
|     case "$ans" in
| 	n*|N*)
| 	    echo "-> Running cdrecord to retrieve multi session info"
| 
| 	    msinfo=`cdrecord dev=0,0,0 -msinfo`
| 
| 	    if [ ! -z $msinfo ]; then
| 		echo "-> cdrecord returned: $msinfo"
| 		echo "-> Running mkisofs:"
| 		echo
| 
| 		find $Backup_Dir -name *.afio -exec echo "${CD_Dir}/="{} \; | \
| 		mkisofs -r -J -l -M 0,0,0 -C $msinfo -V Backup -o $Image_Name \
| 		        -graft-points -path-list -
| 		if [ $? != 0 ]; then
| 		    echo
| 		    echo "-> ** Aborting **"
| 		    exit 1
| 		fi
| 	    else
| 	        echo
| 		echo "-> ** Aborting **"
| 		exit 1;
| 	    fi
| 	;;
| 	y*|Y*)
| 	    echo "-> Running mkisofs:"
| 	    echo
| 
| 	    find $Backup_Dir -name *.afio -exec echo "${CD_Dir}/="{} \; | \
| 	    mkisofs -r -J -l -V Backup -o $Image_Name -graft-points -path-list -
| 
| 	    if [ $? != 0 ]; then
| 		echo
| 		echo "-> ** Aborting **"
| 		exit 1
| 	    fi
| 	;;
|     esac
| }
| 
| #-------------------------------------------------------------------------------
| # Writes $Image_Name to a multi session cd.
| write_image()
| {
|     echo -n "Shall the image be written? [y/n]: "
|     read ans
| 
|     case "$ans" in
| 	y*|Y*)
| 	    echo -n "Is this the last track for this multisession cd? [y/n]: "
| 	    read ans
| 	    
| 	    case "$ans" in
| 		y*|Y*)
| 		    echo "-> Running cdrecord to write last track to disk:"
| 		    echo
| 
| 		    sudo cdrecord -v fs=8m -eject -speed 4 dev=0,0,0 $Image_Name
| 
| 		    if [ $? != 0 ]; then
| 			echo
| 			echo "-> ** Aborting **"
| 			exit 1
| 		    fi
|                 ;;
| 		*)
| 		    echo "-> Running cdrecord to append track to disk:"
| 		    echo
| 
| 		    sudo cdrecord -v fs=8m -multi -eject -speed 4 dev=0,0,0 \
| 		                  $Image_Name
| 
| 		    if [ $? != 0 ]; then
| 			echo
| 			echo "-> ** Aborting **"
| 			exit 1
| 		    fi
| 		;;
| 	        
|           esac
| 	;;
| 	*)
| 	;;
|     esac
| }
| 
| Cur_Dir=$PWD
| cd /
| 
| echo "-> Stopping cron:"
| echo -n "   "
| 
| sudo etc/init.d/cron stop
| 
| echo
| 
| backup_dir boot
| backup_dir dev
| backup_dir etc
| backup_dir home/Debian
| backup_dir home/udo
| backup_dir lib/modules
| backup_dir root
| backup_dir usr/local
| backup_dir var/games
| backup_dir var/lib
| backup_dir var/spool
| 
| echo
| echo "-> Restarting cron:"
| echo -n "   "
| 
| sudo etc/init.d/cron start
| 
| echo
| 
| make_image
| 
| echo
| 
| write_image
| 
| cd $Cur_Dir
| 
| exit 0
`----

Tschoe Udo.

-- 
Zu vermieten.



Reply to: