So, im trying to make a backup of a hard drive and compress it and send it to an ftp server. Similar to g4u. But I dont want to read the whole disk, just up the point where the rest is outside the file system.

So I have:
ibs=1M
count=[equation to get a count to an upper limit.... lets say it is 9000]
dd conv=noerror,sync ibs=$ibs count=$count if=/dev/sdb | sh ftpput.sh $tmpfile ${gzip_opt}
and ftpput.sh is essentially
( cat $tmpfile
dd bs=1m | gzip $gzip_opts
) | ftp -n
tmpfile simply has the commands for ftp inside, like logging in and putting the file.gz.

This code executes no problem and results in a compressed file on the ftp. But when trying to pull it down with slurpdisk.sh or simply decompress it, i get the error that the input is not in gzip format.

The only change i made to the upload script was introduced the count variable. Is this causing problems with gzip's input in the pipe? Resulting in a crazy .gz file that cant be decompressed?