5

How come rsync gives different outputs when there are no files for rsync to transfer, meaning (xfr#0) with rsync from hard disk to hard disk versus rsync from USB flash drive to hard disk?

Using:

  • Ubuntu 20.04.4 LTS (Focal Fossa).
  • rsync version 3.2.3 protocol version 31.

All directories are synced, up to date. Thus no files for rsync to transfer, meaning (xfr#0) when running rsync a second time.

Example 1 script:

src1='/media/u3/d_HDD931GB/TemP'  
dest='/media/u3/s_HDD931GB/1/TemP'   
tput setaf 2  ; echo "$src1   $dest" ;   
tput setaf 1  ; test ! -d "$src1" && echo "ErrorS" ; test ! -d "$dest" && echo "ErrorD" ; tput setaf 2 ;  
time rsync -ah --delete-before --info=progress2 "$src1/" "$dest" --out-format='%t %i %C %b %n %l ' ;  
echo "$src1   $dest" ; echo  ; 

Example 1 output:

/media/u3/d_HDD931GB/TemP   /media/u3/s_HDD931GB/1/TemP   
              0   0%    0.00kB/s    0:00:00 (xfr#0, to-chk=0/5)  

real    0m0.054s  
user    0m0.004s   
sys     0m0.010s  
/media/u3/d_HDD931GB/TemP   /media/u3/s_HDD931GB/1/TemP  

The above is expected. A minimal rsync output when rsync from hard disk to hard disk and rsync has no files to transfer (xfr#0) because hard disk is already synced.

But a long list of files with rsync output when rsync from USB flash drive to hard disk when USB flash drive has no files to transfer (xfr#0) because USB flash drive is already synced and up to date.

Why a such a long list of files with USB flash drive?

Example 2 script, USB flash drive:

src1='/media/u3/F_4GBusb'    
dest='/media/u3/d_HDD931GB/Rare/Sophos'   
tput setaf 3  ; echo "$src1   $dest" ;   
tput setaf 1 ; test ! -d "$src1" && echo "ErrorS" ; test ! -d "$dest" && echo "ErrorD" ; tput setaf 3 ;  
time rsync -ah --delete-before --info=progress2 "$src1/" "$dest" --out-format='%t %i %C %b %n %l ' ;  
echo "$src1   $dest" ; echo  ;  

Example 2 output, USB flash drive:

/media/u3/F_4GBusb   /media/u3/d_HDD931GB/Rare/Sophos  
2022/07/30 20:11:46 .d...p.....                                  0 ./ 4096  
2022/07/30 20:11:46 .f...p.....                                  0 words.txt 4862992  
2022/07/30 20:11:46 .f...p.....                                  0 virtualbox.odt 22142  
etc ...  
etc ...  
etc ...  
etc ...  
etc ... listing 502 files  
etc ...  
              0   0%    0.00kB/s    0:00:00 (xfr#0, to-chk=0/502)  

real    0m0.088s  
user    0m0.015s  
sys     0m0.012s  
/media/u3/F_4GBusb   /media/u3/d_HDD931GB/Rare/Sophos  

Why does rsync give different output when there are no files for rsync to transfer, meaning (xfr#0) with rsync from hard disk to hard disk versus rsync from USB flash drive to hard disk?

Output of sudo fdisk -l:

Disk /dev/sdb: 3.75 GiB, 4005560320 bytes, 7823360 sectors  
Disk model: Flash Disk        
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 512 bytes  
I/O size (minimum/optimal): 512 bytes / 512 bytes  
Disklabel type: dos  
Disk identifier: 0x6f20736b  

Output of lsblk -f:

sdb    vfat     F_4GBusb

More commands --modify-window=7 did not work.

Same problem. Over 500 files listed with no rsync transfers.
2 directories are in sync, so why List 500+ files?

time rsync -ah --delete-before --modify-window=7 --info=progress2 "$src1/" "$dest" --out-format='%t %i %C %b %n %l '

Recall 2 directories are in sync. Thus no rsync transfers.
Meaning (xfr#0, to-chk=0/503)

And -c did not work, same problem.

time rsync -ahc --delete-before --modify-window=7 --info=progress2 "$src1/" "$dest" --out-format='%t %i %C %b %n %l '

And this did not work, just -c no --modify-window=7.

time rsync -ahc --delete-before --info=progress2 "$src1/" "$dest" --out-format='%t %i %C %b %n %l '

rsync from hard disk to hard disk is working as expected
when `file.txt`` is deleted from destination drive.

2022/07/31 01:05:08 >f+++++++++ ad7d6d11c4cf0b771ade515eee5465c8 8945 file.txt 8902     
          8.90K   0%    0.00kB/s    0:00:04 (xfr#1, to-chk=0/121057)
  
3
  • State the Terminal commands to run for Partitioning scheme and Format of USB flash drive, so I can report back with Terminal output.
    – joseph22
    Commented Jul 31, 2022 at 2:05
  • You can use lsblk -f to print the partitions and the filesystem they are formatted to. Commented Jul 31, 2022 at 2:41
  • Update, See bottom of Question.
    – joseph22
    Commented Jul 31, 2022 at 4:59

1 Answer 1

11

The -i "itemize" output tells you exactly why they're not in sync: p in .f...p..... means that rsync considers the file permissions to be different between source and destination.

File permissions will often be different because the FAT filesystem that's used by your USB stick is unable to store them – even after rsync has tried to chmod() the destination files to something else, vfat always reports the exact same modes and ownership that the mount options tell it to report.

Use --no-perms to disable synchronizing file permissions, which is otherwise enabled by -a.

2
  • Correct. Use --no-perms to disable synchronizing file permissions formatted as FAT32 for USB flash drive, stick.
    – joseph22
    Commented Jul 31, 2022 at 6:04
  • For clarity about Permissions, attribute example : Source file attrib = -rw-r--r-- 0 1000 1000 and Target file attrib = -rwxrwxrwx 0 1000 1000 thus --no-perms is working, meaning time rsync -ah --delete-before --no-perms --info=progress2 "$src1/" "$dest" --out-format='%t %i %C %b %n %l '
    – joseph22
    Commented Jul 31, 2022 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .