AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 555673
Accepted
artfulrobot
artfulrobot
Asked: 2013-11-19 02:04:27 +0800 CST2013-11-19 02:04:27 +0800 CST 2013-11-19 02:04:27 +0800 CST

如何有效地维护最新的快照 tar 存档?

  • 772

我有一个很大的文件目录,我想维护一个压缩的 tar 存档,我可以通过 http 提供服务器,其中包含每天更新一次的所有文件。

许多文件不会每天更改,我希望避免每天花费数小时的处理器时间来压缩相同的文件。

tar“无法更新压缩档案”,所以tar uj无济于事。

有没有聪明的方法来做到这一点?

backup
  • 2 2 个回答
  • 419 Views

2 个回答

  • Voted
  1. Best Answer
    artfulrobot
    2013-11-19T02:52:16+08:002013-11-19T02:52:16+08:00

    因为这是通过 http 访问的,所以使用 PHP 使用以下内容即时生成 tar 文件:

    <?php
        set_time_limit(1);
        header("Pragma: public"); // required
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Cache-Control: private",false); // required for certain browsers
        header("Content-Type: application/x-bzip2; charset=binary");
        header("Content-Disposition: attachment; filename=\"archive.tar.bz2\";" );
        passthru("tar cj --exclude-vcs /path/to/files",$err);
        if ($err) {
            error_log("exit value: $err");
        }
        exit;
    

    显然,这对于该文件将被大量下载的情况没有帮助。

    • 0
  2. ndasusers
    2013-11-19T02:55:12+08:002013-11-19T02:55:12+08:00

    这个想法是在一个竞争对手的建议论坛上。

    tar cf --newer YYYYMMDD
    
        To copy differences or only the files since the last tar date 
        here is the command.
    
        Let's say we did a tar on Feb 9th, 2009 as follows:
        (cd /mydata; tar cf - *) | tar xvf -
    
        Today is Feb 11th and we only want to copy the files that have changed 
        since Feb 9th, 2009. The command would be
        (cd /mydata; tar cf - --newer 20090209 * ) | tar xvf - 
    
    • 0

相关问题

  • 总大小(磁盘)与总大小(媒体)

  • 社区对备份解决方案的意见

  • 无法读取不同 LTO-3 驱动器上的 LTO-3 磁带

  • 使用 TSM 备份时跳过硬链接

  • 使用 rsync 维护名称更改的目录的副本

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve