4

enter image description hereCan I see a progress bar or something not only ust the terminal screen output while backing up?

Here is my shell script that I used backup with tar command:

# !/bin/bash

 DATEJOUR=$(date +"%Y-%m-%d-%H-%M-%S")
 REPABACKUPER="--exclude=/home/(username)/myfolders \
 --exclude=/home/(username)/backup                  \
 --exclude=/proc                                    \
 --exclude=/lost+found                              \
 --exclude=/mnt                                     \
 --exclude=/media                                   \
 --exclude=/sys /"
 REPBACKUP="/home/(username)/backup"
 NOMFIC=$REPBACKUP/Pavilion_backup-$DATEJOUR.tar.bz2

 sudo tar cvpjf $NOMFIC $REPABACKUPER


 exit $?

marked as duplicate by jasonwryan, slm, Anthon, Shadur, Marco Jan 27 '14 at 10:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Here is a shell function that combines tar and pv. – Marco Jan 27 '14 at 10:11
  • Thanks all of you.Here is my update and it works. sudo tar -cvpj -f $NOMFIC $REPABACKUPER | pv -cN Backup_Now | tar -xvf - – John Jan 29 '14 at 7:44
4

pipebench shows running time, data processed and speed:

tar -cj --exclude=filename source_dir | pipebench >dest.tar.bz2
4

That's what I use for backup, the progress bar is powered by pv command

tar cf - . --exclude=backup --exclude=$file | pv -s `du -sb . | grep -o '[0-9]\+'` -N tar  | gzip > $file

du -sb . | grep -o '[0-9]\+' this part is responsible for getting 100% in your progress bar

  • 1
    Your tar is using compression, so du isn't going to tell how much data it has to write. (take the z off and pipe to gzip) – Ricky Beam Jan 27 '14 at 8:37
0

Not possible. tar doesn't know how much data it has to work with until it's done with it. Unlike rsync, it does not scan the source tree before processing.

(During extraction, it's possible, but I don't know any versions of tar that bothers.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.