创建多部分 .tar.gz 文件的替代方法?

发布于 2024-10-04 09:08:20 字数 211 浏览 4 评论 0原文

我在Linux服务器上有一个包含>20GB图像的文件夹,我需要备份并下载它,所以我正在考虑使用“split”来创建1GB文件。我的问题是:有没有办法可以创建 20 x 1GB 有效 .tar.gz 文件,以便我可以单独查看/提取它们,而不是分割 .tar.gz 然后在我的计算机上再次加入它?

编辑:我忘了补充一点,我需要在没有 ssh 访问权限的情况下执行此操作。我主要使用 PHP。

I have a folder with >20GB of images on a linux server, I need to make a backup and download it, so I was thinking about using "split" to create 1GB files. My question is: instead of splitting a .tar.gz and then having to join it again on my computer, is there a way I could create 20 x 1GB valid .tar.gz files, so I can then view/extract them separately?

Edit: I forgot to add that I need to do it without ssh access. I'm using mostly PHP.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蝶…霜飞 2024-10-11 09:08:21

为什么不直接使用rsync呢?

仅供参考,rsync 是一个命令行工具,用于同步网络上两台计算机之间的目录。如果两端都有 Linux 并且正确配置了 ssh 访问,则就像 rsync -av server:/path/to/images/ images/ 一样简单(确保结尾斜杠在那里)。它还优化了后续同步,以便仅传输更改。您甚至可以告诉它压缩传输中的数据,但这通常对图像没有帮助。

Why not just use rsync?

FYI, rsync is a command-line tool that synchronises directories between two machines across the network. If you have Linux at both ends and ssh access properly configured, it's as simple as rsync -av server:/path/to/images/ images/ (make sure the trailing slashes are there). It also optimises subsequent synchronisations so that only changes are transmitted. You can even tell it to compress data in transit, but that usually doesn't help with images.

蓝眼泪 2024-10-11 09:08:21

首先,如果您没有 SSH 访问权限,我会放弃 rsnapshot。 (尽管我确实并且喜欢它)

我假设您可能正在备份 jpeg,并且它们已经被压缩。压缩它们并不会使它们变得更小,而且您不需要正好 1GB 的文件。听起来它们可以更大或更小一点。

因此,您可以编写一个脚本,将 jpeg 捆绑到 gz(或其他)中,直到放入大约 1GB 的文件,然后启动一个新的存档。

您可以在 PHP 中轻松完成这一切。

First I would give rsnapshot a miss if you don't have SSH access. (Though I do and love it)

I would assume you're likely backing up jpeg's and they are already compressed. Zipping them up doesn't make them much smaller, plus you don't need exactly 1GB files. It sounds like they can be a bit bigger or smaller.

So you could just write a script which bundles jpegs into a gz(or whatever) until it has put about 1gb worth in and then starts a new archive.

You could do all this in PHP easy enough.

温柔戏命师 2024-10-11 09:08:20

您可以尝试 rsnapshot 使用 rsync/hardlinks 进行备份。它不仅解决了文件大小问题,而且当现有图像不经常更改时,还可以为您提供高存储和带宽效率。

You could try rsnapshot to backup using rsync/hardlinks instead. It not only solves the filesize issue but also gives you high storage and bandwidth efficiency when existing images aren't changed often.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文