gzip archives coming up invalid!

Chris W. Parker cparker at swatgear.com
Thu Jan 6 20:32:56 UTC 2005


Hello,

I've been running a script in /etc/cron.daily that tar's the /etc,
/home, and /var directories and then gzip's them. After the gzip they
are FTP'd to a backup server.

I've just had the need to retrieve a file in one of the backups and it
turns out they are all corrupt! This is not good. :(

[root at hachiroku ~/temp]# gzip -t 01-01-05.home.tar.gz

gzip: 01-01-05.home.tar.gz: invalid compressed data--format violated
[root at hachiroku ~/temp]#

This is the script I am using, maybe there is a problem with it?? Or
maybe the corruption is happening during the FTP transfer?

=-=-=-=-=-=-=
#!/bin/bash

# set variables
DATE=`date +%m-%d-%y`
OLDDATE=`date +%m-%d-%y --date '7 days ago'`

# make sure we are executing the following commands from the correct
directory
cd /

# make the /var archive
tar -cW --totals --label $DATE.var -f $DATE.var.tar /var
gzip -9 -S .gz $DATE.var.tar

# make the /etc archive
tar -cW --totals --label $DATE.etc -f $DATE.etc.tar /etc
gzip -9 -S .gz $DATE.etc.tar

# make the /home archive
tar -cW --totals --label $DATE.home -f $DATE.home.tar /home
gzip -9 -S .gz $DATE.home.tar

echo "*** connecting to ftp and uploading files"

ftp -n ati-nas-01.ati.local > /var/log/lastbackup << endend
user user password
cd /linuxbackup/hachiroku
pwd
bell
del $OLDDATE.var.tar.gz
del $OLDDATE.etc.tar.gz
del $OLDDATE.home.tar.gz
put $DATE.var.tar.gz
put $DATE.etc.tar.gz
put $DATE.home.tar.gz
ls
quit
endend

#echo "***   Removing Backup Files"
rm -f $DATE.*tar.gz

#echo "*** Done"
exit 0
=-=-=-=-=-=-=-=-=


Any ideas would be appreciated!

The average size of the compressed /var file is ~68MB. /etc is ~1.5MB.
/home is ~50MB.


Thanks,
Chris.




More information about the redhat-list mailing list