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:

ベストアンサー1

おすすめ記事