Help with Progress bar in rsync

Not sure if this is the right place to ask, more of a coding type question. I have been given permission to ask this question by @joekamprad provided I supply him with a large crate of beer. Anyway I would like some help with getting a progress bar working in rsync

# location of files

# NOF = number of files in AIROOTFS
NOF=$(find ${AIROOTFS} -type f | wc -l)
# transfer files in AIROOTFS to new device, show a progress bar
rsync -a --progress $AIROOTFS $MNT/ | pv -lep -s ${NOF} > /dev/null

Not sure if ‘find’ is the correct way to go. Have seen it done this way using ‘du’

# a version using du....
rsync -av source/ destination/ | pv -p -t -r -s $(du -sb source/ | awk '{print $1}') > /dev/null

Any thoughts on getting it working correctly?

In the ARM image installer, we use bsdtar to untar a image and create a progress bar using pv

Go to

and look at line 198

 pv "enosLinuxARM-rpi-latest.tar.zst" | zstd -T0 -cd -  | bsdtar -xf -  -C MP2

Maybe you can come up with something for your usage ?


1 Like

@Pudge The files are not compressed like ARM image. The /run/archiso/airootfs are normal files and folders which get copied to new install target device. The problem is a user is shown 200%+ as bar progresses which does annoy some even though file transfer works.

I would run without pv if a user just got some indication that something was happening.

Looking on Arch wiki for rsync there is no mention of pv but some info on using progress/progress2 but I think it is more for remote transfers [ssh]

Thank you for your help :wink: