diff를 이용하여 대량 파일들을 빠르게 비교할 수 있게하는 옵션

manabooks의 이미지

상황
----------------------------------------------------
서로 다른 두 컴퓨터(A, B)의 특정 작업디렉토리를 USB-memory통해 동조(sync) 시키고 싶었습니다.
두 컴퓨터에 각각 FAT32 파티션을 만들고 그곳에 작업디렉토리를 생성한 후,
rsync를 이용하여 한 컴퓨터(A)의 자료를 USB-memory에 동조(sync)시킨뒤, USB-memory의 자료를 다른 컴퓨터(B)에서 rsync를 이용하여 동조시키는 것입니다.
[ A => USB-memory => B ]
문제는 rsync가 가동되기전, rsync가 삭제할파일들을 찾아 tar로 압축시켜 보관하는 과정을 집어넣고 싶었고, 이에 파일을 비교하기 위해 diff를 이용하였습니다. 사용한 옵션은
diff -qr
그런데 diff가 너무느려 600MB의 디렉토리 전체를 검사하는데, 1분이 넘게 걸립니다.
반면 rsync 가 모든 작업을 수행하는 시간은 25초를 넘지 않습니다. 사용한 옵션은
rsync -arv --delete
---------------------------------------------------

rsync 의 속도가 현저히 빠른 것을 보면,
diff도 적절한 옵션을 통해 빠른 작동이 가능할 것으로 생각됩니다.
man page에서는 눈에 띄는 옵션이 보이지 않네요.

고수분들의 많은 관심과 조언을 부탁드립니다.

[참고로 OS는 모두 Slackware 12.0 입니다.]

wkpark의 이미지

rsync는 diff의 비교 메카니즘이 다르기때문이 아닐까요?

diff로 텍스트간의 차이점을 알아내는 방법 vs 파일이 다른지 다르지 않은지를 아는 방법상 차이랄까..

예를들어, 1) filesize가 다르면 무조건 다른 파일로 생각
2) filesize가 같고 *time이 다르면 파일이 다른건지 체크

rsync 소스 혹은 설명서를 검토해보면 답을 얻으실 듯

온갖 참된 삶은 만남이다 --Martin Buber

ysy05의 이미지

꼭 diff로 일일이 다 비교해야하는 상황이 아니라면
파일 비교할때, md5sum을 이용해서 비교 해도 되지 않나요?
파일 사이즈가 이것도 좀 시간이 걸리긴 걸리던데.

natas999의 이미지

svn을 사용 해 보시면 어떨까요?

# emerge girl-friend
Calculating dependencies
!!! All wemen who could satisfy "girl-friend" have been masked.

# emerge girl-friend
Calculating dependencies
!!! All wemen who could satisfy "girl-friend" have been masked.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.