"tar: 압축된 아카이브를 확인할 수 없습니다" 오류를 수정하는 방법은 무엇입니까?

"tar: 압축된 아카이브를 확인할 수 없습니다" 오류를 수정하는 방법은 무엇입니까?

디렉터리를 특정 형식으로 압축하고 작성한 후 확인하고 싶어서 .tar.xz다음과 같은 명령을 작성했습니다.

tar --xz --create --verbose --verify --file myArchive.tar.xz /patch/to/my/dir

하지만 아카이브가 생성되지 않아 다음 두 줄의 오류가 발생합니다.

    tar: Cannot verify compressed archives 
    try 'tar --help' or 'tar --usage' for more information.

tar.gz대신 형식을 사용해 보았지만 tar.xz결과는 똑같았습니다. 문제는 무엇이며 해결 방법은 무엇입니까?

답변1

tar 매뉴얼의 섹션 9.8은 다음과 같이 말합니다.

9.8 Verifying Data as It is Stored
==================================

`-W'
`--verify'
     Attempt to verify the archive after writing.

   This option causes `tar' to verify the archive after writing it.
Each volume is checked after it is written, and any discrepancies are
recorded on the standard error output.

   Verification requires that the archive be on a back-space-able
medium.  This means pipes, some cartridge tape drives, and some other
devices cannot be verified.

압축된 아카이브는 백스페이스를 수행할 수 없으므로 두 옵션을 혼합하려고 하면 오류가 발생합니다.

다음 단락에서는 --compare이를 사용해야 한다고 언급합니다.

   One can explicitly compare an already made archive with the file
system by using the `--compare' (`--diff', `-d') option, instead of
using the more automatic `--verify' option.  *Note compare::.

   Note that these two options have a slightly different intent.  The
`--compare' option checks how identical are the logical contents of some
archive with what is on your disks, while the `--verify' option is
really for checking if the physical contents agree and if the recording
media itself is of dependable quality.  So, for the `--verify'
operation, `tar' tries to defeat all in-memory cache pertaining to the
archive, while it lets the speed optimization undisturbed for the
`--compare' option.  If you nevertheless use `--compare' for media
verification, you may have to defeat the in-memory cache yourself,
maybe by opening and reclosing the door latch of your recording unit,
forcing some doubt in your operating system about the fact this is
really the same volume as the one just written or read.

   The `--verify' option would not be necessary if drivers were indeed
able to detect dependably all write failures.  This sometimes require
many magnetic heads, some able to read after the writes occurred.  One
would not say that drivers unable to detect all cases are necessarily
flawed, as long as programming is concerned.

확인을 위해 --compare다음을 수행할 수 있습니다.

tar --xz --create --verbose --file myArchive.tar.xz /patch/to/my/dir
tar --compare --file myArchive.tar.xz /patch/to/my/dir

관련 정보