tar 형식은 체크섬을 지원합니까?

tar 형식은 체크섬을 지원합니까?

TLDR, 내 주요 질문:

tar 형식은 기본적으로 체크섬을 지원합니까?

tar 형식의 체크섬이 내장된 tar(더 나은) 파일을 만드는 방법은 무엇입니까?tar.gz


롱: 왜 내가 대안을 묻거나 제안하는지 묻기 전에…

왜 그런 것이 존재할 수 있다고 생각합니까?

VirtualBox 소스 코드 파일tarvfs.cpp보여주다. 관련 코드 조각은 다음과 같습니다. [1] [2]

  • 내가 찾고 있는 것: 내장 체크섬을 지원하는 tar 형식이 있습니까?
  • 내가 찾고 있지 않은 것:
    • sha256sums 또는 아카이브 자체에 추가된 유사한 파일/파일을 사용하는 해결 방법입니다. 이 사용 사례에는 적합하지 않습니다.
    • vboxmanage modifymedium --compact/zerofree왜냐하면 나는 이미 이것을 사용하고 있기 때문입니다.
  • 내가 왜 신경쓰나요?

명령줄을 사용하여 수동으로 생성한 VirtualBox ova를 가져오려고 하면 다음과 같은 메시지가 나타납니다.VERR_TAR_BAD_CHKSUM_FIELD

tar --gzip --create --verbose --directory=/home/user/temp --file empty.ova temp-disk001.vmdk temp-disk002.vmdk temp.mf temp.ovf

임시 디스크 001.vmdk 임시 디스크 002.vmdk temp.mf temp.ovf

vboxmanage import empty.ova ; echo $?
Progress state: VBOX_E_IPRT_ERROR
VBoxManage: error: Appliance read failed
VBoxManage: error: Error reading OVA '/home/user/temp/empty.ova' (VERR_TAR_BAD_CHKSUM_FIELD)
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component ApplianceWrap, interface IAppliance
VBoxManage: error: Context: "RTEXITCODE handleImportAppliance(HandlerArg*)" at line 471 of file VBoxManageAppliance.cpp

--gzip매개변수 에서 제거 하면 tar작동합니다.

tar    --create    --verbose      --directory=/home/user/temp    --file empty.ova    temp-disk001.vmdk  temp-disk002.vmdk  temp.mf  temp.ovf

그런 다음 작업을 가져옵니다.

vboxmanage import empty.ova ; echo $?

[...]0

  • 왜 사용하지 않습니까 vboxmanage export? 생성되는 tar 파일은 암호화되지 않고 gzip 압축도 없기 때문입니다.
  • 나의 주요 목표는 무엇입니까? .ova추가 .NET 파일 없이 VirtualBox로 직접 가져올 수 있는 gzip으로 압축된 VirtualBox 장치입니다 .tar.gz.
  • VirtualBox ova는 압축되지 않나요? 아니요, 이것은 단지 tar 파일입니다. gzip 또는 xz 압축 아카이브가 아닙니다.
  • 그런데 파일 안의 파일은 .vmdk압축되어 있는 걸까요? .ova예, 하지만 압축은 제한되어 있습니다. 추가 .tar.gz최대 압축을 사용하면 .ova크기가 작아집니다.
  • 추가 .tar.gz파일을 사용하지 않는 이유는 무엇입니까? 압축, 속도, 유용성, 단순성.
  • .ovaVirtualBox가 실제로 파일인 파일을 가져올 수 있는 이유는 무엇이라고 생각하시나요 .tar.gz? VirtualBox 소스 파일 때문에ApplianceImplImport.cppgzip이 여러 번 언급되었습니다.
  • 내가 이 모든 것을 언급하는 이유는 무엇입니까? 내가 본 대부분의 질문은 vboxmanage modifymedium --compact/ 방향과 관련되어 있기 때문입니다 zerofree. 그래서 여기서는 매우 구체적으로 설명하고 싶습니다. .ovagzip 압축 파일입니다.

[1]

/**
 * Validates the TAR header.
 *
 * @returns VINF_SUCCESS if valid, VERR_TAR_ZERO_HEADER if all zeros, and
 *          the appropriate VERR_TAR_XXX otherwise.
 * @param   pTar                The TAR header.
 * @param   penmType            Where to return the type of header on success.
 */
static int rtZipTarHdrValidate(PCRTZIPTARHDR pTar, PRTZIPTARTYPE penmType)
{
    /*
     * Calc the checksum first since this enables us to detect zero headers.
     */
    int32_t i32ChkSum;
    int32_t i32ChkSumSignedAlt;
    if (rtZipTarCalcChkSum(pTar, &i32ChkSum, &i32ChkSumSignedAlt))
        return VERR_TAR_ZERO_HEADER;

    /*
     * Read the checksum field and match the checksums.
     */
    int64_t i64HdrChkSum;
    int rc = rtZipTarHdrFieldToNum(pTar->Common.chksum, sizeof(pTar->Common.chksum), true /*fOctalOnly*/, &i64HdrChkSum);
    if (RT_FAILURE(rc))
        return VERR_TAR_BAD_CHKSUM_FIELD;
    if (   i32ChkSum          != i64HdrChkSum
        && i32ChkSumSignedAlt != i64HdrChkSum) /** @todo test this */
        return VERR_TAR_CHKSUM_MISMATCH;

[2]

/*
 * Copyright (C) 2010-2020 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 *
 * The contents of this file may alternatively be used under the terms
 * of the Common Development and Distribution License Version 1.0
 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
 * VirtualBox OSE distribution, in which case the provisions of the
 * CDDL are applicable instead of those of the GPL.
 *
 * You may elect to license modified versions of this file under the
 * terms and conditions of either the GPL or the CDDL or both.
 */

업데이트 1:

관련 정보