LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 09-12-2017, 07:01 AM   #1
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Rep: Reputation: Disabled
rsync using the pv command wrong ETA


hi all,

i am copying a directory from folder a to folder b like so -

time rsync -avh /folder_a/ /folder_b/

this is 30gigs and it takes roughly 18 min to complete, i have done it multiple times

it works but now i want to pipe it with the pv command to get the ETA and the progress ie the progress bar and the percent

i use this command -

rsync -avh /folder_a/ /folder_b/ | pv -lep -s 17 > /dev/null

folder a has 17 files in it, i work this out by doing a "find -type f | wc -l" when i cd in folder a

but when i run the command the ETA just keeps going up up and up, it never stops so it doesnt give you 18 min like with the rsync command did

any help on this would be greatly appreciated

many thanks,

rob

Last edited by robertkwild; 09-12-2017 at 07:04 AM.
 
Old 09-12-2017, 07:52 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,305
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
pv can't really do more than get in the way of the transfer. rsync has it's own built-in option for tracking progress:

Code:
rsync -avh --human-readable --progress /folder_a/ /folder_b/
For details, see "man rsync"
 
Old 09-12-2017, 08:35 AM   #3
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
this is good but this does a progress for each individual file copied, i want a whole progress for the directory including ETA aswell
 
Old 09-12-2017, 09:50 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by robertkwild View Post
Code:
rsync -avh /folder_a/ /folder_b/ | pv -lep -s 17 > /dev/null
That "-s 17" is telling the pv command that the expected total size of the transfer is 17 bytes. You're not going to get reasonable progress indications from that. When pv is getting its input from a pipe, that "-s" (--size) argument is the only clue it has about the expected size of the transfer, and you can't, in general, accurately predict how much data rsync will send. If all the files are new at the destination and there is no compression involved, you can estimate by using the total size of all the files plus some overhead. For incremental updates of existing files, it's really difficult to predict.

Last edited by rknichols; 09-12-2017 at 12:33 PM. Reason: Totally misinterpreting what was going on
 
Old 09-12-2017, 09:53 AM   #5
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
ok 17 is the file count and not the size of the directory, so shall i change it to the size, will this give me a better ETA?
 
Old 09-12-2017, 10:11 AM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by robertkwild View Post
ok 17 is the file count and not the size of the directory, so shall i change it to the size, will this give me a better ETA?
That depends on what you mean by, "size of the directory." The directory file itself has a size. That's just for storage of the file names, inode numbers, and some status information. What you need is the total size of the files, like what would be reported by du for that directory. There will be some overhead in addition to that (see how much rsync would send if you use the "-n" option to suppress the actual transfer), but if the files themselves are large it should be a reasonable approximation.

Last edited by rknichols; 09-12-2017 at 12:34 PM. Reason: Totally misinterpreting what was going on
 
Old 09-12-2017, 10:18 AM   #7
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
ok im doing this -

[root@robw-linux ~]# du -s /mnt/local/data/call_the_midwife_7_1708/
32455212 /mnt/local/data/call_the_midwife_7_1708/
[root@robw-linux ~]# rsync -avh /mnt/local/data/call_the_midwife_7_1708/ /mnt/local/data/folder/ | pv -lep -s 32455212 > /dev/null
[> ] 0% ETA 1011:03:44

but the ETA is way way out
 
Old 09-12-2017, 10:57 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,691

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
From the pv man pages:
Quote:
-l, --line-mode
Instead of counting bytes, count lines (newline characters). The
progress bar will only move when a new line is found, and the
value passed to the -s option will be interpreted as a line
count.
Using the number of files is correct versus byte size when using the -l option. I have not played with rsync/pv in awhile and can not say why the ETA is off at the moment.

https://www.cyberciti.biz/faq/show-p...file-transfer/
 
Old 09-12-2017, 11:16 AM   #9
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
this is very interesting -

https://linoxide.com/linux-command/t...mand-progress/

mmm... seems to give you the status of just files copied and not the whole directory which is a shame

Last edited by robertkwild; 09-12-2017 at 11:59 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync showing wrong output system11 Linux - Server 3 02-17-2011 06:38 AM
ETA Slack 13.2 clifford227 Slackware 65 12-08-2010 03:11 AM
rsync problems, can you look at my command? - Rsync gurus. Spuddy Linux - Software 4 09-21-2010 10:25 AM
rsync uses wrong directory, has wrong size but right file count? brianpbarnes Linux - Software 1 02-23-2009 05:48 PM
RSYNC - What Am I Doing Wrong? carlosinfl Linux - General 3 09-05-2007 04:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 04:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration