找回密码
 注册
搜索
热搜: 回贴
微赢网络技术论坛 门户 服务器 Linux/BSD 查看内容

系统备份(用Partimage来备份/恢复分区)

2009-12-20 13:08| 发布者: admin| 查看: 145| 评论: 0|原作者: 云天青



双操作系统安装好了,XP和CentOS5共同居住在我的计算机中了。现在来回头来说说系统备份吧,这个问题折腾我一段时间,关于Partimage方面的教程网上也有,还是图解的,菜鸟看了基本上都知道怎么操作。但我看很多遍都看不明白,就是不知道备份文件是放在哪里的?以前用Ghost来备份系统,都会有叫你选择要备份的分区,然后叫你选择保存在那个分区中(非备份分区),而在partimage中却不一样,这个问题弄了我好久,最后还是知道了,呵呵。下面来说说用Partimage来备份/恢复分区,我是用
Clonezilla(再生龙)
中的Partimage来进行。
备份分区:
把Clonezilla(再生龙)光盘放进光驱吧(用其它带有partimage的LiveCD版的Linux也行),以光盘启动。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828220856.png');}" onmousewheel="return imgzoom(this);" alt="" />
一会就出显上图了,菜鸟看不英文就干脆选择第1个就行了(我选择的第3个,只是选了个648*768的分辨率,因为在虚拟机中,为了切图小一点)。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828220934.png');}" onmousewheel="return imgzoom(this);" alt="" />
选择语言,我就按默认的选择English了。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221027.png');}" onmousewheel="return imgzoom(this);" alt="" />
英文的,想看就看吧,回车“OK”下一步了。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221048.png');}" onmousewheel="return imgzoom(this);" alt="" />
配置控制台数据,就默认“Don't touch keymap”吧。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221121.png');}" onmousewheel="return imgzoom(this);" alt="" />
这里选择“Enter_shell”这个进入shell了。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221145.png');}" onmousewheel="return imgzoom(this);" alt="" />
又开始要输入命令了,大概说下:
“sudo su -”切换到超极用户权限。
“fdisk -l”显示硬盘的分区信息。
“ls /mnt”显示/mnt目录中的文件,这里是空的,就用它做挂载点吧。
“mount -t vfat /dev/hda5 /mnt”挂载hda5分区到/mnt目录中,为什么要挂载这个分区?因为我要把hda1分区备份到hda5分区中,现在hda5被挂载到了/mnt目录中了,进入/mnt目录就相当于进入了hda5分区了。
“cd /mnt”进入/mnt目录了。
“ls”显示当前目录中的文件,结果什么也没有,空的!
“pwd”显示当前所在目录的路径,这就是这备份文件保存的路径了。备份文件是保存在当前目录的,所以前面挂载hda5分区,并且进入hda5分区,这样备份文件就保存在hda5分区中。
“partimage”最后就是运行这个程序了。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221210.png');}" onmousewheel="return imgzoom(this);" alt="" />
这就像以前进入Ghost界面一样,解说下:
Partimage to save / restore 这是选择要进行备份/恢复的分区,但不能选择挂载了的分区(所以不能选择hda5这个分区),分区不可能既是被备份的分区,又是保存备份的分区。
Image file to create / use 给备份文件取名吧。
Save partition into a new image file 这是选项表示备份分区操作。
Restore partiton from an image file 这是选项表示恢复分区操作。
在 Partimage to save / restore 中选择了分区,要进行备份还是恢复操作,就要在 Save partition into a new image file 和 Restore partiton from an image file 中选择了。
我们这里是备份分区,所以选择 Save partition into a new image file 这个选项(空格键选中)。
其它的就默认吧,按“F5”进入下一步!
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221242.png');}" onmousewheel="return imgzoom(this);" alt="" />
Compression level 这个表示是压缩级别:
None(不压缩)、Gzip(一般压缩)、Bzip2(高压缩)就样理解就行了,这与Ghost中最后那一步是一样的,选择压缩方式。都是“一般压缩”的,这里也就按默认的选择Gzip的压缩方式吧。
Check partition before saving 表示最大检查分区错误。
Enter description 表示输入标示信息。
Image split mode 文件分割模中的 Into file whose size is:2037 表示超过2037兆自动分割。
If finished successfully 中的选择 Wait 表示备份成功后等待用户指令。
菜鸟弄不懂就干脆全部默认吧,继续“F5”进入下一步。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221316.png');}" onmousewheel="return imgzoom(this);" alt="" />
这里是添加标示信息(注释信息),继续“OK”进入下一步。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221335.png');}" onmousewheel="return imgzoom(this);" alt="" />
如果备份的是ext2或者ext3格式分区的情况,而且分区比较大,会在这个界面等下来的,只需耐心等等就弹出下面的界面了。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221407.png');}" onmousewheel="return imgzoom(this);" alt="" />
显示的备份分区的分区信息,我是要备份的hda1分区,所在这里显示的hda1的分区信息,继续“OK”就开始备份分区了。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221427.png');}" onmousewheel="return imgzoom(this);" alt="" />
这是备份的进度信息,对正在备份时可以[* 中止]、[Ctrl S 暂停]、[Ctrl Q 继续]等操作,等到100%就备份完毕,弹出下面界面。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221458.png');}" onmousewheel="return imgzoom(this);" alt="" />
到这里,备份就算完成了,继续“OK”就回到Shell中了。
恢复分区:
这里我把hda1-backup.000恢复到hda1分区中。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221558.png');}" onmousewheel="return imgzoom(this);" alt="" />
恢复分区就不需要进入备份文件所在目录了,只要知道备份文件在那个目录中就行了。
图中的命令:
“ls”刚才备份的hda1分区,用“ls”显示当前目录,在当前目录中有个“hda1-backup.000”的备份文件了吧。
“cd”进入当前用户的家目录(就是root目录),不在备份文件目录也行。
“pwd”显示所在目录的路径。
“partimage”最后启动程序了。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080829001547.png');}" onmousewheel="return imgzoom(this);" alt="" />
Partimage to save / restore 这是选择要进行恢复的分区。
Image file to create / use 这里输入备份文件的完整路径及名称。
Action to be done 中要选择 Restore partition from an image file 这个选项了(空格选中)。
按“F5”进入下一步。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221744.png');}" onmousewheel="return imgzoom(this);" alt="" />
弹出备份时的注释信息了,继续“OK”进入下一步。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221801.png');}" onmousewheel="return imgzoom(this);" alt="" />

Simulation of the restoration (nothing is written) 这是模拟恢复,不会向磁盘写入文件。如果确认没有问题,就不必选择这个选项了。
Erase free blocks with zero values 用空数据覆盖空分区。
If finished successfully 栏目选择 Wait 表示备份成功后等待用户指令。
继续按“F5”进入下一步吧。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221819.png');}" onmousewheel="return imgzoom(this);" alt="" />
这里显示的是即将被恢复分区的信息(就是hda1分区的信息),继续“OK”进入下一步。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221843.png');}" onmousewheel="return imgzoom(this);" alt="" />
弹出这个对话来进行确认,是否要把hda1-backup.000恢复到hda1分区中,“Yes”则继续,“No”则取消,我们继续吧,选择“Yes”就进行对hda1分区的恢复操作了。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828221909.png');}" onmousewheel="return imgzoom(this);" alt="" />
这是恢复分区的进度信息,同样有[* 中止]、[Ctrl S 暂停]、[Ctrl Q 继续]等操作,等待进度条100%就恢复完毕了,弹出下面界面。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080828222009.png');}" onmousewheel="return imgzoom(this);" alt="" />
恢复完毕,继续“Ok”回到Shell中。
输入“umount /mnt”卸载hda5分区。
输入“reboot”重新启动计算机。
用Partimage备份/恢复分区的操作到此结束,够菜了吧,呵呵!
注意事项:
限制1: 不能自己克隆自己,也就是说不能克隆一个正在运行的linux系统,这里面的技术限制想必容易理解。因此,需要将原盘挂到另外一个linux系统上。
限制2: 目标分区的尺寸不能小于原分区-例如原分区的大小为15G,虽然可能实际使用的容量不到5G,但还是无法克隆到一个小于15G的分区上。
限制3: 如果备份的分区有MBR,不能使用bzip2压缩格式,如果您选择bzip2压缩格式系统会弹出提示信息。
还有些关于Partimage的一些命令参数,我就不说了,网上有详细点的Partimage资料如下两个连接:

最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 15:24 , Processed in 0.138135 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.