Programming

rsync-rsync 로그에서 f +++++++++는 무엇을 의미합니까?

procodes 2020. 8. 27. 22:04
반응형

rsync-rsync 로그에서 f +++++++++는 무엇을 의미합니까?


rsync내 서버 파일의 백업을 만드는 데 사용 하고 있는데 두 가지 질문이 있습니다.

  1. 프로세스 중간에 중지하고 rsync다시 시작 해야합니다.
    rsync이 중지하거나 처음부터 다시 시작한다는 점에서 시작?

  2. 로그 파일에서 나는 "f+++++++++". 무슨 뜻인가요?

예 :

2010/12/21 08:28:37 [4537] >f.st...... iddd/logs/website-production-access_log
2010/12/21 08:29:11 [4537] >f.st...... iddd/web/website/production/shared/log/production.log
2010/12/21 08:29:14 [4537] .d..t...... iddd/web/website/production/shared/sessions/
2010/12/21 08:29:14 [4537] >f+++++++++ iddd/web/website/production/shared/sessions/ruby_sess.017a771cc19b18cd
2010/12/21 08:29:14 [4537] >f+++++++++ iddd/web/website/production/shared/sessions/ruby_sess.01eade9d317ca79a

rsync가 어떻게 작동하는지 살펴보고 숨겨진 결과 라인을 더 잘 이해해 보겠습니다.

1-rsync의 큰 장점은 중단 후에도 다음 번에 원활하게 계속된다는 것입니다.

다음 rsync 호출은 그 동안 변경되지 않은 경우 이미 전송 된 파일을 다시 전송하지 않습니다. 그러나 중단되었음을 알지 못하기 때문에 처음부터 모든 파일을 다시 확인하기 시작합니다.

2-각 문자는에 대한 섹션을 읽으면 번역 할 수있는 코드입니다 -i, --itemize-changes.man rsync

질문에서 예제 로그 파일을 디코딩합니다.

> f.st ......

> - the item is received
f - it is a regular file
s - the file size is different
t - the time stamp is different

.d..t ......

. - the item is not being updated (though it might have attributes 
    that are being modified)
d - it is a directory
t - the time stamp is different

> f +++++++++

> - the item is received
f - a regular file
+++++++++ - this is a newly created item

rsync 매뉴얼 페이지의 관련 부분 :

-i, --itemize-changes

속성 변경을 포함하여 각 파일에 적용되는 변경 사항의 간단한 항목 별 목록을 요청합니다. 이것은 --out-format = '% i % n % L'을 지정하는 것과 정확히 동일합니다. 옵션을 반복하면 변경되지 않은 파일도 출력되지만 수신 rsync가 버전 2.6.7 이상인 경우에만 (이전 버전의 rsync에서 -vv를 사용할 수 있지만 다른 자세한 메시지의 출력도 켜집니다. 현자).

"% i"이스케이프에는 11 자 길이의 암호화 된 출력이 있습니다. 일반 형식은 YXcstpoguax 문자열과 같습니다. 여기서 Y는 수행중인 업데이트 유형으로 대체되고, X는 파일 유형으로 대체되며, 다른 문자는 수정중인 경우 출력 될 수있는 속성을 나타냅니다.

Y를 대체하는 업데이트 유형은 다음과 같습니다.

  • A <는 파일이 원격 호스트로 전송 (전송)되고 있음을 의미합니다.
  • A >는 파일이 로컬 호스트로 전송 (수신 됨)됨을 의미합니다.
  • A c는 항목에 대해 로컬 변경 / 생성이 발생 함을 의미합니다 (예 : 디렉토리 생성 또는 심볼릭 링크 변경 등).
  • A h는 항목이 다른 항목에 대한 하드 링크임을 의미합니다 (--hard-links 필요).
  • A .는 항목이 업데이트되고 있지 않음을 의미합니다 (수정중인 속성이있을 수 있음).
  • A *는 항목 별 출력 영역의 나머지 부분에 메시지 (예 : "삭제")가 포함되어 있음을 의미합니다.

X를 대체하는 파일 유형은 다음과 같습니다 : f파일 d용, 디렉토리 L용, 심볼릭 링크 D용, 장치 S특수 파일 용 (예 : 명명 된 소켓 및 fifo).

위 문자열의 다른 문자는 항목의 관련 속성이 업데이트되는 경우 출력되는 실제 문자 또는 "."입니다. 변화가 없습니다. 이에 대한 세 가지 예외는 (1) 새로 생성 된 항목이 각 문자를 "+"로 대체하고, (2) 동일한 항목이 점을 공백으로 대체하고, (3) 알 수없는 속성이 각 문자를 "?"로 대체하는 것입니다. (이전 rsync와 대화 할 때 발생할 수 있습니다).

각 문자와 연관된 속성은 다음과 같습니다.

  • A c는 일반 파일에 다른 체크섬이 있거나 (--checksum 필요) 심볼릭 링크, 장치 또는 특수 파일에 변경된 값이 있음을 의미합니다. 3.0.1 이전의 rsync로 파일을 보내는 경우이 변경 플래그는 체크섬이 다른 일반 파일에 대해서만 표시됩니다.
  • A s means the size of a regular file is different and will be updated by the file transfer.
  • A t means the modification time is different and is being updated to the sender’s value (requires --times). An alternate value of T means that the modification time will be set to the transfer time, which happens when a file/symlink/device is updated without --times and when a symlink is changed and the receiver can’t set its time. (Note: when using an rsync 3.0.0 client, you might see the s flag combined with t instead of the proper T flag for this time-setting failure.)
  • A p means the permissions are different and are being updated to the sender’s value (requires --perms).
  • An o means the owner is different and is being updated to the sender’s value (requires --owner and super-user privileges).
  • A g means the group is different and is being updated to the sender’s value (requires --group and the authority to set the group).
  • The u slot is reserved for future use.
  • The a means that the ACL information changed.
  • The x means that the extended attribute information changed.

One other output is possible: when deleting files, the "%i" will output the string "*deleting" for each item that is being removed (assuming that you are talking to a recent enough rsync that it logs deletions instead of outputting them as a verbose message).


Some time back, I needed to understand the rsync output for a script that I was writing. During the process of writing that script I googled around and came to what @mit had written above. I used that information, as well as documentation from other sources, to create my own primer on the bit flags and how to get rsync to output bit flags for all actions (it does not do this by default).

I am posting that information here in hopes that it helps others who (like me) stumble up on this page via search and need a better explanation of rsync.

With the combination of the --itemize-changes flag and the -vvv flag, rsync gives us detailed output of all file system changes that were identified in the source directory when compared to the target directory. The bit flags produced by rsync can then be decoded to determine what changed. To decode each bit's meaning, use the following table.

Explanation of each bit position and value in rsync's output:

YXcstpoguax  path/to/file
|||||||||||
||||||||||╰- x: The extended attribute information changed
|||||||||╰-- a: The ACL information changed
||||||||╰--- u: The u slot is reserved for future use
|||||||╰---- g: Group is different
||||||╰----- o: Owner is different
|||||╰------ p: Permission are different
||||╰------- t: Modification time is different
|||╰-------- s: Size is different
||╰--------- c: Different checksum (for regular files), or
||              changed value (for symlinks, devices, and special files)
|╰---------- the file type:
|            f: for a file,
|            d: for a directory,
|            L: for a symlink,
|            D: for a device,
|            S: for a special file (e.g. named sockets and fifos)
╰----------- the type of update being done::
             <: file is being transferred to the remote host (sent)
             >: file is being transferred to the local host (received)
             c: local change/creation for the item, such as:
                - the creation of a directory
                - the changing of a symlink,
                - etc.
             h: the item is a hard link to another item (requires 
                --hard-links).
             .: the item is not being updated (though it might have
                attributes that are being modified)
             *: means that the rest of the itemized-output area contains
                a message (e.g. "deleting")

Some example output from rsync for various scenarios:

>f+++++++++ some/dir/new-file.txt
.f....og..x some/dir/existing-file-with-changed-owner-and-group.txt
.f........x some/dir/existing-file-with-changed-unnamed-attribute.txt
>f...p....x some/dir/existing-file-with-changed-permissions.txt
>f..t..g..x some/dir/existing-file-with-changed-time-and-group.txt
>f.s......x some/dir/existing-file-with-changed-size.txt
>f.st.....x some/dir/existing-file-with-changed-size-and-time-stamp.txt 
cd+++++++++ some/dir/new-directory/
.d....og... some/dir/existing-directory-with-changed-owner-and-group/
.d..t...... some/dir/existing-directory-with-different-time-stamp/

Capturing rsync's output (focused on the bit flags):

In my experimentation, both the --itemize-changes flag and the -vvv flag are needed to get rsync to output an entry for all file system changes. Without the triple verbose (-vvv) flag, I was not seeing directory, link and device changes listed. It is worth experimenting with your version of rsync to make sure that it is observing and noting all that you expected.

One handy use of this technique is to add the --dry-run flag to the command and collect the change list, as determined by rsync, into a variable (without making any changes) so you can do some processing on the list yourself. Something like the following would capture the output in a variable:

file_system_changes=$(rsync --archive --acls --xattrs \
    --checksum --dry-run \
    --itemize-changes -vvv \
    "/some/source-path/" \
    "/some/destination-path/" \
| grep -E '^(\.|>|<|c|h|\*).......... .')

In the example above, the (stdout) output from rsync is redirected to grep (via stdin) so we can isolate only the lines that contain bit flags.

Processing the captured output:

The contents of the variable can then be logged for later use or immediately iterated over for items of interest. I use this exact tactic in the script I wrote during researching more about rsync. You can look at the script (https://github.com/jmmitchell/movestough) for examples of post-processing the captured output to isolate new files, duplicate files (same name, same contents), file collisions (same name, different contents), as well as the changes in subdirectory structures.


1) Wodin, that's not entirely true. If using --partial or -P tag (same as --partial --progress) rsync resumes interrupted transfers.

2) Exactly, that's common output for the --itemize-changes tag.


1.) It will "restart the sync", but it will not transfer files that are the same size and timestamp etc. It first builds up a list of files to transfer and during this stage it will see that it has already transferred some files and will skip them. You should tell rsync to preserve the timestamps etc. (e.g. using rsync -a ...)

While rsync is transferring a file, it will call it something like .filename.XYZABC instead of filename. Then when it has finished transferring that file it will rename it. So, if you kill rsync while it is transferring a large file, you will have to use the --partial option to continue the transfer instead of starting from scratch.

2.) I don't know what that is. Can you paste some examples?

EDIT: As per http://ubuntuforums.org/showthread.php?t=1342171 those codes are defined in the rsync man page in section for the the -i, --itemize-changes option.

Fixed part if my answer based on Joao's

참고URL : https://stackoverflow.com/questions/4493525/rsync-what-means-the-f-on-rsync-logs

반응형