怎么做增量备份?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
头像
yechf
帖子: 305
注册时间: 2006-04-27 12:18
来自: 浙江德清武康

怎么做增量备份?

#1

帖子 yechf » 2009-11-06 23:11

sudo tar czvpf /media/hda6/910.tar.gz / --exclude=/media/* --exclude=/proc/* --exclude=/sys/* --exclude=/home/* --exclude=/tmp/*
我用上面的命令做好了一个备份,下次做的话,我想简单地增量备份到/media/hda6/910.tar.gz就可以。
man过了,也google了,还是很不清楚。谁告知一下。谢谢。
头像
ecsthetic
帖子: 63
注册时间: 2009-09-14 1:03

Re: 怎么做增量备份?

#2

帖子 ecsthetic » 2009-11-07 1:07

记得man tar貌似有说明,增量很重要。
Using linux is a science, but the pratise of using linux itself is an art.
头像
yechf
帖子: 305
注册时间: 2006-04-27 12:18
来自: 浙江德清武康

Re: 怎么做增量备份?

#3

帖子 yechf » 2009-11-07 8:47

各位,说具体点啊。
头像
冲浪板
论坛版主
帖子: 7513
注册时间: 2007-05-06 8:19

Re: 怎么做增量备份?

#4

帖子 冲浪板 » 2009-11-07 9:45

原有文件(如try.txt)用不到删除了,那么目标里的备份会怎么样?
头像
yechf
帖子: 305
注册时间: 2006-04-27 12:18
来自: 浙江德清武康

Re: 怎么做增量备份?

#5

帖子 yechf » 2009-11-07 11:10

其实应该说是差异备份。
头像
ecsthetic
帖子: 63
注册时间: 2009-09-14 1:03

Re: 怎么做增量备份?

#6

帖子 ecsthetic » 2009-11-07 16:04

http://www.apl.jhu.edu/Misc/Unix-info/tar/tar_28.html

用append,这个应该能帮到你。 :em05
Using linux is a science, but the pratise of using linux itself is an art.
头像
yechf
帖子: 305
注册时间: 2006-04-27 12:18
来自: 浙江德清武康

Re: 怎么做增量备份?

#7

帖子 yechf » 2009-11-07 20:04

看不动哦。
直接告诉我好了。
楼上,拜托
头像
ecsthetic
帖子: 63
注册时间: 2009-09-14 1:03

Re: 怎么做增量备份?

#8

帖子 ecsthetic » 2009-11-08 1:08

tar -rvf 原本的tar 你的文件
这个是把新文件加入tar
Using linux is a science, but the pratise of using linux itself is an art.
头像
yechf
帖子: 305
注册时间: 2006-04-27 12:18
来自: 浙江德清武康

Re: 怎么做增量备份?

#9

帖子 yechf » 2009-11-08 7:03

wlp@wlp-desktop:~$ mkdir a
wlp@wlp-desktop:~$ touch a/a1
wlp@wlp-desktop:~$ tar czvpf a.tar.gz a
a/ all-music.m3u
wlp@wlp-desktop:~$ tar czvpf a.tar.gz a/
a/
a/a1
wlp@wlp-desktop:~$ touch a/a2
wlp@wlp-desktop:~$ tar rvf a.tar.gz a/a2
tar: 无法更新压缩归档文件
tar: 错误不可恢复:现在退出
wlp@wlp-desktop:~$
头像
ecsthetic
帖子: 63
注册时间: 2009-09-14 1:03

Re: 怎么做增量备份?

#10

帖子 ecsthetic » 2009-11-08 10:32

mkdir a
touch a/a1
tar -cvpf a.tar a
touch a/a2
tar -rvpf a.tar a/a2

貌似不能用gz和bz。
Using linux is a science, but the pratise of using linux itself is an art.
头像
yechf
帖子: 305
注册时间: 2006-04-27 12:18
来自: 浙江德清武康

Re: 怎么做增量备份?

#11

帖子 yechf » 2009-11-08 10:45

那样的话,备份跟cp有什么区别?
头像
ecsthetic
帖子: 63
注册时间: 2009-09-14 1:03

Re: 怎么做增量备份?

#12

帖子 ecsthetic » 2009-11-08 10:48

用&&后天加上吧,我所知道的。不过感觉上应该是可以的。
Using linux is a science, but the pratise of using linux itself is an art.
头像
冲浪板
论坛版主
帖子: 7513
注册时间: 2007-05-06 8:19

Re: 怎么做增量备份?

#13

帖子 冲浪板 » 2009-11-08 11:05

思想不同...差别大了
头像
yechf
帖子: 305
注册时间: 2006-04-27 12:18
来自: 浙江德清武康

Re: 怎么做增量备份?

#14

帖子 yechf » 2009-11-08 11:06

qkbeyond, 冲浪板, 一起研究一下哦。
头像
foolegg
帖子: 249
注册时间: 2007-12-01 14:56

Re: 怎么做增量备份?

#15

帖子 foolegg » 2009-11-08 11:35

tar要进行这种备份很困难
尤其是要删除tar里的文件时,效率低下

tar一般不用来进行日常备份的,更多用于系统转移,也就是把一个硬盘上的东西转到另一个硬盘上

要进行这种日常性的备份,建议使用rsync

备份

代码: 全选

rsync -P -a -v -u -z --delete 备份源路径 备份目标路径
恢复其实也一样

代码: 全选

rsync -P -a -v -u -z --delete 源路径 目标路径
回复