จำนวนไฟล์ Rsync สถิติ


8

ฉันใช้ rsync พร้อม-vrlHh --delete --stats --forceตัวเลือกในการทำมิเรอร์สองไดเรกทอรี ไดเรกทอรีแรกคือแหล่งที่มาและเป็น hd ภายนอกของฉันไดเรกทอรีปลายทางว่างเปล่าเพราะฉันเพิ่งสร้างมันขึ้นมา

ฉันทำงานrsync -vrlHh --delete --stats --force my_hd dest_dirและฉันได้รับผลลัพธ์นี้

...

2012/05/12 11:59:29 [18094] Number of files: 189315
2012/05/12 11:59:29 [18094] Number of files transferred: 178767
2012/05/12 11:59:29 [18094] Total file size: 241.57G bytes
2012/05/12 11:59:29 [18094] Total transferred file size: 241.57G bytes
2012/05/12 11:59:29 [18094] Literal data: 241.57G bytes
2012/05/12 11:59:29 [18094] Matched data: 0 bytes
2012/05/12 11:59:29 [18094] File list size: 4.08M
2012/05/12 11:59:29 [18094] File list generation time: 0.002 seconds
2012/05/12 11:59:29 [18094] File list transfer time: 0.000 seconds
2012/05/12 11:59:29 [18094] Total bytes sent: 241.61G
2012/05/12 11:59:29 [18094] Total bytes received: 3.44M
2012/05/12 11:59:29 [18094] sent 241.61G bytes  received 3.44M bytes  30.67M bytes/sec
2012/05/12 11:59:29 [18094] total size is 241.57G  speedup is 1.00

คำถามของฉันคือสาเหตุNumber of filesและNumber of file transferredแตกต่างกันหากไดเรกทอรีปลายทางว่างเปล่า

คำตอบ:


12

ผมเชื่อว่าคุณกำลังประสบhttp://lists.samba.org/archive/rsync/2008-April/020692.html

ในระยะสั้นrsyncใช้คำว่า "ไฟล์" ในวิธีที่แตกต่างกันขึ้นอยู่กับบริบท ใน "จำนวนไฟล์" แรกของคุณนับมันจะนับทุกอย่าง ใน "จำนวนไฟล์ที่ถ่ายโอน" ครั้งที่สองจะไม่นับลิงก์สัญลักษณ์และไดเรกทอรีเป็นไฟล์

ตัวอย่าง:

$ mkdir test
$ touch test/testfile
$ ln -s testfile test/testlink
$ ls -FR test
test:
testfile  testlink@
$ rsync -vrlHh --stats test test2
sending incremental file list
created directory test2
test/
test/testfile
test/testlink -> testfile

Number of files: 3
Number of files transferred: 1
Total file size: 8 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 67
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 126
Total bytes received: 38

sent 126 bytes  received 38 bytes  328.00 bytes/sec
total size is 8  speedup is 0.05
$ ls -FR test2
test2:
test/

test2/test:
testfile  testlink@

ในปีนี้จะมีความชัดเจนมากขึ้นในเวอร์ชัน 3:Number of files: XXX (reg: Y, dir: Z)
William Entriken

4

จากผู้แต่ง 'Mike Bombich' ใน rsync@lists.samba.org:

สำหรับสถิติ rsync ใช้คำว่า "file" ไม่สอดคล้องกัน เมื่อรายงานจำนวน "จำนวนไฟล์" ทั้งหมดจะระบุจำนวนทั้งหมดของวัตถุระบบไฟล์ซึ่งประกอบด้วยไฟล์ไดเรกทอรี symlink ข้อเสนอพิเศษและอุปกรณ์ต่าง ๆ เมื่อรายงานจำนวนการโอน "ไฟล์" มันจะอ้างถึงไฟล์ปกติเท่านั้น

ดังนั้นหากมีไฟล์ที่ไม่ปกติอยู่ในนั้น (inc. ไดเรกทอรี) ไฟล์เหล่านั้นจะไม่รวมอยู่ในการนับ

โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.