Always wanted to make a tar file without using any local diskspace? This is the solution:

tar zcf - . | pv | ssh foo@bar.com "cat > /data/backup.tgz";

It even has got a progress bar:

163MB 0:00:19 [8,21MB/s] [     < =>     ]

Remember to install pv first:

sudo ap-get install pv


2 comments so far

Add Your Comment
  1. Rafael


    What if I want to “get” a tar from remote server and display progress bar. I have this working:

    ssh root@ “tar -zcpf – / –exclude-caches –exclude=dev –exclude=sys –exclude=mnt –exclude=proc –exclude=sys –exclude=misc –exclude=lost+found –exclude=var/run –exclude=var/spool/squid ” | cat > Backup_$(date +%Y-%m-%d).tgz

    but don’t know how to include pv in this sentence.

    Thank you

  2. asdf

    replace cat with pv