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

Re: tar, backup, growisofs, file names



* Andy Polyakov (appro@fy.chalmers.se) [031205 22:38]:
> > > > /bin/tar cf -   --files-from $INCLUDEFILE \
> > > >                 --exclude-from $EXCLUDEFILE \
> > > >                 --absolute-names \
> > > >         | bzip2 --best --stdout \
> > > >         | growisofs -Z /dev/dvd=/dev/fd/0
> > > >
> > > > like this, growisofs writes to the raw medium, without a fs (i
> > > > think). that is half ok for full backups, but i wanted to do
> > > > incremental backups, too, to the same dvd.
> > > >
> > > > how can i have  * reading from stdin (from tar/bzip)
> > > >                 * named backup files and a filesystem
> > > >                 * no writing to hardisc first (i dont want
> > > >                   to rely on 4.4G beeing free.)

now i dropped the last point and create a temporal file on the
harddisk first. here is my script:

===========================================================================
#!/bin/sh
set -x
TMPDIR=`mktemp -d /tmp/backup.XXXXXX` || exit 1
INCLUDEFILE=/root/.backup_include
EXCLUDEFILE=/root/.backup_exclude
SNAPSHOTFILE=/root/.backup_snapshot
LABEL="`hostname`-`date -I`"
BKFILE="${TMPDIR}/${LABEL}"

trap "rm -rf ${TMPDIR}" 0

TAR_BACKUP="--one-file-system \
                --files-from $INCLUDEFILE \
                --exclude-from $EXCLUDEFILE \
                --listed-incremental=$SNAPSHOTFILE
                --absolute-names"

case "$1" in
        full)
                rm -f $SNAPSHOTFILE
                BKFILE="$BKFILE-full.tar"
                MODE=-Z
                TAR_OPTS="cf $BKFILE $TAR_BACKUP \
                          --label=$LABEL-full"
        ;;
        incremental)
                MODE=-M
                BKFILE="$BKFILE-incremental.tar"
                TAR_OPTS="cf $BKFILE $TAR_BACKUP \
                          --label=$LABEL-incremental"
        ;;
        *)
                echo "usage: $0 full|incremental"
                exit 1
        ;;
esac

/bin/tar $TAR_OPTS
bzip2 --best $BKFILE
BKFILE="$BKFILE.bz2"
growisofs $MODE /dev/dvd -J -R $BKFILE
==========================================================================


now i my resulting file gets truncated when written to dvd+rw and i end up with 

-rw-r--r--    1 root     root       626862 Dec  8 09:08 lukas-2003-12-08-full.tar.bz2

it should have been 1.4Gig in size, aproximatly.

I would have imagined that growisofs takes care of media-size? i
see that mkisofs has the -stream-media-size option. do i have to
set that?



Reply to: