简体   繁体   English

将大 tar 文件拆分为多个 tar 文件

[英]Splitting large tar file into multiple tar files

I have a tar file which is 3.1 TB(TeraByte)我有一个 3.1 TB(TeraByte) 的 tar 文件

File name - Testfile.tar文件名 - Testfile.tar

I would like to split this tar file into 2 parts - Testfil1.tar and Testfile2.tar我想将此 tar 文件分成两部分 - Testfil1.tar 和 Testfile2.tar

I tried the following so far split -b 1T Testfile.tar "Testfile.tar"到目前为止,我尝试了以下split -b 1T Testfile.tar "Testfile.tar"

What i get is Testfile.taraa(what is "aa")我得到的是Testfile.taraa(什么是“aa”)

And i just stopped my command.我刚刚停止了我的命令。 I also noticed that the output Testfile.taraa doesn't seem to be a tar file when I do ls in the directory.当我在目录中执行 ls 时,我还注意到 output Testfile.taraa似乎不是 tar 文件。 It seems like it is a text file.它似乎是一个文本文件。 May be once the full split is completed it will look like a tar file?可能一旦完全拆分完成,它看起来像一个 tar 文件?

The behavior from split is correct, from man page online: http://man7.org/linux/man-pages/man1/split.1.html拆分的行为是正确的,来自在线手册页: http://man7.org/linux/man-pages/man1/split.1.html

Output pieces of FILE to PREFIXaa, PREFIXab, ... Output 文件到 PREFIXaa, PREFIXab, ...

Don't stop the command let it run and then you can use cat to concatenate (join) them all back again.不要停止命令让它运行,然后你可以使用cat再次连接(加入)它们。

Examples can be seen here: https://unix.stackexchange.com/questions/24630/whats-the-best-way-to-join-files-again-after-splitting-them示例可以在这里看到: https://unix.stackexchange.com/questions/24630/whats-the-best-way-to-join-files-again-after-splitting-them

split -b 100m myImage.iso
# later
cat x* > myImage.iso

UPDATE Just as clarification since I believe you have not understood the approach.更新就像澄清一样,因为我相信你还没有理解这种方法。 You split a big file like this to transport it for example, files are not usable this way.例如,您拆分这样的大文件来传输它,文件不能以这种方式使用。 To use it again you need to concatenate (join) pieces back.要再次使用它,您需要连接(连接)片段。 If you want usable parts, then you need to decompress the file, split it in parts and compress them.如果你想要可用的部分,那么你需要解压缩文件,将它分成几部分并压缩它们。 With split you basically split the binary file.使用 split 您基本上可以拆分二进制文件。 I don't think you can use those parts.我不认为你可以使用这些部分。

You are doing the compression first and the partition later.您先进行压缩,然后再进行分区。

If you want each part to be a tar file, you should use 'split' first with de original file, and then 'tar' with each part.如果您希望每个部分都成为 tar 文件,则应首先对原始文件使用“split”,然后对每个部分使用“tar”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM