- -v:顯示傳輸過(guò)程中的詳細(xì)信息,-v 可以用通過(guò)增加 v參數(shù)的數(shù)量來(lái)顯示更多詳盡的信息。最全面,最詳盡的傳輸信息是 5個(gè)v(-vvvvv)。
- 4-10.6 內(nèi)容:
通過(guò) rsync -a -v 把文件傳輸?shù)侥繕?biāo)目錄。標(biāo)識(shí) -v 不同數(shù)量所增加了哪些信息內(nèi)容。 - 操作步驟:
1、新建一個(gè) backups_v 目錄用作 -v 參數(shù)測(cè)試的目標(biāo)目錄。
[root@localhost test]# mkdir backups_v
[root@localhost test]# tree
.
├── backups_v
└── SRC
├── demo1.txt
├── demo2.txt
└── demo3.txt
2 directories, 3 files
[root@localhost test]#
2、為了清晰一點(diǎn),先刪除 SRC 目錄下的文件,重新創(chuàng)建 1 個(gè)文件。
[root@localhost test]#
[root@localhost test]# ll SRC/
total 8
-rw-rw-rw-. 1 root root 6 Aug 8 22:41 demo1.txt
-rw-rw-rw-. 1 root root 10 Aug 8 22:47 demo2.txt
-rw-rw-rw-. 1 root root 0 Jul 22 22:44 demo3.txt
[root@localhost test]#
[root@localhost test]# rm -rf SRC/* ## 刪除 SRC目錄下的所有文件
[root@localhost test]#
[root@localhost test]# ll SRC/
total 0
[root@localhost test]# touch SRC/demo1.txt ## SRC目錄下只創(chuàng)建一個(gè) demo1.txt
[root@localhost test]#
[root@localhost test]# ll SRC/
total 0
-rw-r--r--. 1 root root 0 Aug 10 22:13 demo1.txt
[root@localhost test]#
3、用 rsync -a SRC/demo1.txt 到 backups_v 目錄。
## 沒(méi)有 -v 的加持,傳輸數(shù)據(jù)時(shí)不會(huì)顯示信息。
[root@localhost test]# rsync -a SRC/demo1.txt backups_v/
[root@localhost test]#
[root@localhost test]# tree
.
├── backups_v
│ └── demo1.txt
└── SRC
└── demo1.txt
2 directories, 2 files
[root@localhost test]#
4、用 rsync -a -v SRC/demo1.txt 到 backups_v 目錄,并改名為demo2.txt。
[root@localhost test]# rsync -a -v SRC/demo1.txt backups_v/demo2.txt
## {... 花括號(hào)內(nèi)是 -v 所顯示的傳輸信息
sending incremental file list
demo1.txt
sent 91 bytes received 35 bytes 252.00 bytes/sec
total size is 0 speedup is 0.00
##...}
[root@localhost test]#
[root@localhost test]# tree
.
├── backups_v
│ ├── demo1.txt
│ └── demo2.txt ## 生成 demo2.txt
└── SRC
└── demo1.txt
2 directories, 3 files
[root@localhost test]#
5、用 rsync -a -vv SRC/demo1.txt 到 backups_v 目錄,并改名為demo3.txt。
[root@localhost test]#
[root@localhost test]# rsync -a -vv SRC/demo1.txt backups_v/demo3.txt
sending incremental file list
##{...花括號(hào)內(nèi)是比 -v 多出的內(nèi)容
delta-transmission disabled for local transfer or --whole-file
##...}
demo3.txt is uptodate
##{...花括號(hào)內(nèi)是比 -v 多出的內(nèi)容
total: matches=0 hash_hits=0 false_alarms=0 data=0
##...}
sent 91 bytes received 102 bytes 386.00 bytes/sec
total size is 0 speedup is 0.00
[root@localhost test]#
[root@localhost test]# tree
.
├── backups_v
│ ├── demo1.txt
│ ├── demo2.txt
│ └── demo3.txt ## 生成 demo3.txt
└── SRC
└── demo1.txt
2 directories, 4 files
[root@localhost test]#
6、用 rsync -a -vvv SRC/demo1.txt 到 backups_v 目錄,并改名為demo4.txt。
[root@localhost test]#
[root@localhost test]# rsync -a -vvv SRC/demo1.txt backups_v/demo4.txt
sending incremental file list
## {... 花括號(hào)內(nèi)是比 -vv 多出的內(nèi)容
[sender] make_file(demo1.txt,*,0)
send_file_list done
send_files starting
server_recv(2) starting pid=1665
recv_file_name(demo1.txt)
received 1 names
recv_file_list done
get_local_name count=1 backups_v/demo4.txt
generator starting pid=1665
##...}
delta-transmission disabled for local transfer or --whole-file
## {... 花括號(hào)內(nèi)是比 -vv 多出的內(nèi)容
recv_generator(demo4.txt,1)
send_files(1, SRC/demo1.txt)
send_files mapped SRC/demo1.txt of size 0
calling match_sums SRC/demo1.txt
##...}
demo1.txt
## {... 花括號(hào)內(nèi)是比 -vv 多出的內(nèi)容
sending file_sum
false_alarms=0 hash_hits=0 matches=0
sender finished SRC/demo1.txt
generate_files phase=1
recv_files(1) starting
recv_files(demo4.txt)
got file_sum
set modtime of .demo4.txt.bG1QTi to (1628604804) Tue Aug 10 22:13:24 2021
renaming .demo4.txt.bG1QTi to demo4.txt
send_files phase=1
recv_files phase=1
generate_files phase=2
send_files phase=2
send files finished
##...}
total: matches=0 hash_hits=0 false_alarms=0 data=0
## {... 花括號(hào)內(nèi)是比 -vv 多出的內(nèi)容
recv_files phase=2
recv_files finished
generate_files phase=3
generate_files finished
##...}
sent 91 bytes received 594 bytes 1,370.00 bytes/sec
total size is 0 speedup is 0.00
## {... 花括號(hào)內(nèi)是比 -vv 多出的內(nèi)容
[sender] _exit_cleanup(code=0, file=main.c, line=1179): about to call exit(0)
##...}
[root@localhost test]#
[root@localhost test]# tree
.
├── backups_v
│ ├── demo1.txt
│ ├── demo2.txt
│ ├── demo3.txt
│ └── demo4.txt ## 生成 demo4.txt
└── SRC
└── demo1.txt
2 directories, 5 files
[root@localhost test]#
7、用 rsync -a -vvvv SRC/demo1.txt 到 backups_v 目錄,并改名為demo5.txt。
[root@localhost test]# rsync -a -vvvv SRC/demo1.txt backups_v/demo5.txt
## {... 花括號(hào)內(nèi)是比 -vvv 多出的內(nèi)容
cmd=<NULL> machine=<NULL> user=<NULL> path=backups_v/demo5.txt
cmd[0]=. cmd[1]=backups_v/demo5.txt
msg checking charset: UTF-8
(Server) Protocol versions: remote=31, negotiated=31
(Client) Protocol versions: remote=31, negotiated=31
##...}
sending incremental file list
[sender] make_file(demo1.txt,*,0)
## {... 花括號(hào)內(nèi)是比 -vvv 多出的內(nèi)容
[sender] flist start=1, used=1, low=0, high=0
[sender] i=1 SRC demo1.txt mode=0100644 len=0 uid=0 gid=0 flags=1005
##...}
send_file_list done
## {... 花括號(hào)內(nèi)是比 -vvv 多出的內(nèi)容
[sender] flist_eof=1
file list sent
##...}
send_files starting
server_recv(2) starting pid=1669
## {... 花括號(hào)內(nèi)是比 -vvv 多出的內(nèi)容
uid 0() maps to 0
gid 0() maps to 0
##...}
recv_file_name(demo1.txt)
received 1 names
## {... 花括號(hào)內(nèi)是比 -vvv 多出的內(nèi)容
[Receiver] flist start=1, used=1, low=0, high=0
[Receiver] i=1 1 demo1.txt mode=0100644 len=0 uid=0 gid=0 flags=1000
##...}
recv_file_list done
## {... 花括號(hào)內(nèi)是比 -vvv 多出的內(nèi)容
[Receiver] flist_eof=1
##...}
get_local_name count=1 backups_v/demo5.txt
generator starting pid=1669
delta-transmission disabled for local transfer or --whole-file
recv_generator(demo5.txt,1)
send_files(1, SRC/demo1.txt)
## {... 花括號(hào)內(nèi)是比 -vvv 多出的內(nèi)容
count=0 n=0 rem=0
##...}
send_files mapped SRC/demo1.txt of size 0
calling match_sums SRC/demo1.txt
demo1.txt
sending file_sum
false_alarms=0 hash_hits=0 matches=0
sender finished SRC/demo1.txt
generate_files phase=1
recv_files(1) starting
recv_files(demo5.txt)
got file_sum
set modtime of .demo5.txt.vyCUfy to (1628604804) Tue Aug 10 22:13:24 2021
renaming .demo5.txt.vyCUfy to demo5.txt
send_files phase=1
recv_files phase=1
generate_files phase=2
send_files phase=2
send files finished
total: matches=0 hash_hits=0 false_alarms=0 data=0
recv_files phase=2
recv_files finished
generate_files phase=3
generate_files finished
## {... 花括號(hào)內(nèi)是比 -vvv 多出的內(nèi)容
client_run waiting on 1669
##...}
sent 91 bytes received 790 bytes 1,762.00 bytes/sec
total size is 0 speedup is 0.00
## {... 花括號(hào)內(nèi)是比 -vvv 多出的內(nèi)容
[sender] _exit_cleanup(code=0, file=main.c, line=1179): entered
##...}
[sender] _exit_cleanup(code=0, file=main.c, line=1179): about to call exit(0)
[root@localhost test]#
[root@localhost test]# tree
.
├── backups_v
│ ├── demo1.txt
│ ├── demo2.txt
│ ├── demo3.txt
│ ├── demo4.txt
│ └── demo5.txt ## 生成 demo5.txt
└── SRC
└── demo1.txt
2 directories, 6 files
[root@localhost test]#
8、用 rsync -a -vvvvv SRC/demo1.txt 到 backups_v 目錄,并改名為demo6.txt。
[root@localhost test]# rsync -a -vvvvv SRC/demo1.txt backups_v/demo6.txt
## {... 花括號(hào)內(nèi)是比 -vvvv 多出的內(nèi)容
FILE_STRUCT_LEN=24, EXTRA_LEN=4
##...}
cmd=<NULL> machine=<NULL> user=<NULL> path=backups_v/demo6.txt
cmd[0]=. cmd[1]=backups_v/demo6.txt
msg checking charset: UTF-8
(Server) Protocol versions: remote=31, negotiated=31
(Client) Protocol versions: remote=31, negotiated=31
sending incremental file list
[sender] change_dir(/root/test/SRC)
[sender] make_file(demo1.txt,*,0)
[sender] flist start=1, used=1, low=0, high=0
[sender] i=1 SRC demo1.txt mode=0100644 len=0 uid=0 gid=0 flags=1005
send_file_list done
[sender] flist_eof=1
file list sent
send_files starting
server_recv(2) starting pid=1690
uid 0() maps to 0
gid 0() maps to 0
recv_file_name(demo1.txt)
received 1 names
[Receiver] flist start=1, used=1, low=0, high=0
[Receiver] i=1 1 demo1.txt mode=0100644 len=0 uid=0 gid=0 flags=1000
recv_file_list done
[Receiver] flist_eof=1
get_local_name count=1 backups_v/demo6.txt
## {... 花括號(hào)內(nèi)是比 -vvvv 多出的內(nèi)容
[Receiver] change_dir(/root/test/backups_v)
##...}
generator starting pid=1690
delta-transmission disabled for local transfer or --whole-file
recv_generator(demo6.txt,1)
send_files(1, SRC/demo1.txt)
count=0 n=0 rem=0
send_files mapped SRC/demo1.txt of size 0
calling match_sums SRC/demo1.txt
demo1.txt
sending file_sum
false_alarms=0 hash_hits=0 matches=0
sender finished SRC/demo1.txt
generate_files phase=1
recv_files(1) starting
recv_files(demo6.txt)
got file_sum
set modtime of .demo6.txt.Fd0KT4 to (1628604804) Tue Aug 10 22:13:24 2021
renaming .demo6.txt.Fd0KT4 to demo6.txt
send_files phase=1
recv_files phase=1
generate_files phase=2
send_files phase=2
send files finished
total: matches=0 hash_hits=0 false_alarms=0 data=0
recv_files phase=2
recv_files finished
generate_files phase=3
generate_files finished
client_run waiting on 1690
sent 91 bytes received 838 bytes 1,858.00 bytes/sec
total size is 0 speedup is 0.00
[sender] _exit_cleanup(code=0, file=main.c, line=1179): entered
[sender] _exit_cleanup(code=0, file=main.c, line=1179): about to call exit(0)
[root@localhost test]#
[root@localhost test]# tree
.
├── backups_v
│ ├── demo1.txt
│ ├── demo2.txt
│ ├── demo3.txt
│ ├── demo4.txt
│ ├── demo5.txt
│ └── demo6.txt ## 生成 demo6.txt
└── SRC
└── demo1.txt
2 directories, 7 files
[root@localhost test]#
9、檢查源文件屬性和目標(biāo)目錄文件屬性(屬性一致)。
[root@localhost test]# ll SRC/
total 0
-rw-r--r--. 1 root root 0 Aug 10 22:13 demo1.txt
[root@localhost test]#
[root@localhost test]# ll backups_v/
total 0
-rw-r--r--. 1 root root 0 Aug 10 22:13 demo1.txt
-rw-r--r--. 1 root root 0 Aug 10 22:13 demo2.txt
-rw-r--r--. 1 root root 0 Aug 10 22:13 demo3.txt
-rw-r--r--. 1 root root 0 Aug 10 22:13 demo4.txt
-rw-r--r--. 1 root root 0 Aug 10 22:13 demo5.txt
-rw-r--r--. 1 root root 0 Aug 10 22:13 demo6.txt
- 上述的測(cè)試,-v 可以顯示文件傳輸過(guò)程中的信息?;拘畔?-v,隨著 v 數(shù)量增加會(huì)逐步列出更為詳細(xì)的信息。最詳盡的傳輸信息是 -vvvvv。