+ -
当前位置:首页 → 问答吧 → tar 备份问题

tar 备份问题

时间:2011-01-18

来源:互联网

服务器上有一个目录//home/ias10g/image很大,目前300多G
在这个目录下有很多子目录,现在要求检索出每天新增的文件,然后在tar包压缩,这个命令怎么写,求教,谢谢!

作者: ly215197   发布时间: 2011-01-18

回复 ly215197


    tar  增量备份  适合你不  具体查下资料

   或  -u 参数

作者: taojie2000   发布时间: 2011-01-18

用 find +xargs

作者: 版主杀手   发布时间: 2011-01-18



QUOTE:
回复  ly215197


    tar  增量备份  适合你不  具体查下资料

   或  -u 参数
taojie2000 发表于 2011-01-18 15:14




    能具体点么?

作者: ly215197   发布时间: 2011-01-18



QUOTE:
用 find +xargs
版主杀手 发表于 2011-01-18 15:23




    find /home/ias10g/image -mtime -1 |xargs tar -zcvf /home/ias10g/backup/image .tar.gz

我试过了,不行!

作者: ly215197   发布时间: 2011-01-18

回复 ly215197


    http://blogold.chinaunix.net/u3/93470/showart_2013892.html

    你find 命令那报什么错?

作者: taojie2000   发布时间: 2011-01-18



QUOTE:
回复  ly215197


   

    你find 命令那报什么错?
taojie2000 发表于 2011-01-18 16:26




   find /prod/image -mtime -1 这个命令能找出当天生成的文件,但是加了后面的命令却把所有image下的文件都打包了,要怎么修改啊?

作者: ly215197   发布时间: 2011-01-18

回复 ly215197


    不清楚  原因

作者: taojie2000   发布时间: 2011-01-18

通过命令检索:
[ias10g@d0-lnxapp03 1]$ find /prod//prod/html_gelc_prod/image_life/001/2011/1 -mtime -1
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300116.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300115.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300114.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300113.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300112.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300111.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300110.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300109.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300108.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300107.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300106.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/889/01002255571300105.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/1
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/1/01002255571300104.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/1/01002255571300103.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/1/01002255571300102.tif
/prod/html_gelc_prod/image_life/001/2011/1/18/16/010022555713001/1/01002255571300101.tif
检索出来都是今天的文件,这个没问题

作者: ly215197   发布时间: 2011-01-18

ias10g@d0-lnxapp03 1]$ find /prod/html_gelc_prod/image_life/001/2011/1 -mtime -1 |xargs tar -zcvf test.tar.gz
tar: Removing leading `/' from member names
/prod/html_gelc_prod/image_life/001/2011/1/
/prod/html_gelc_prod/image_life/001/2011/1/3/
/prod/html_gelc_prod/image_life/001/2011/1/3/13/
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500117.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500116.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500115.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500114.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500113.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500112.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500111.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500110.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500109.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500108.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500107.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500106.tif
/prod/html_gelc_prod/image_life/001/2011/1/3/13/010019221715001/889/01001922171500105.tif
怎么打包就把3号的文件都打进去了?

作者: ly215197   发布时间: 2011-01-18

回复 ly215197


   
    你可以看看增量备份   不过用增量  需要今天重新完整备份下   -g 参数

   以后可以根据完整备份  只备份变化的!

     查资料

作者: taojie2000   发布时间: 2011-01-18

你的意思是我先做一个完整备份:image1.tar.gz
然后通过命令进行增量备份
tar -g /prod/html_gelc_prod/image_life -zcf image1.tar.gz
完成后image1.tar.gz 只是更新了变化的?

那么增量备份中只是包含更新的文件还说所有文件都有呢?

作者: ly215197   发布时间: 2011-01-18