备份策略 一
使用G4L 将硬盘完整备份
=================================================
概述:将母硬盘资料全部拷贝到子硬盘之中。
备份源(母硬盘):CentOS6.3.vmdk
备份目标(子硬盘):CentOS6.3_backup.vmdk
备份工具:E:\F\开发工具\Linux虚拟机\备份工具\g4l-v0.42
=================================================
G4L URL :http://sourceforge.net/projects/g4l/
2 虚拟机硬盘情况
母硬盘 (硬盘 SCSI) 子硬盘(新硬盘SCSI)
将g4l的ISO镜像挂载到虚拟机的光驱中,启动虚拟机,设置BIOS为光盘驱动,进入g4l的界面。
1 挂载镜像文件到虚拟机光驱
2 选择 启动到BIOS设置
3 设置BIOS为光驱启动为第一位
4 进入主界面 默认回车
5 输入命令 ./g4l
6 选择YES
7 选择第一项 RAW 模式
8 选择克隆功能
9 选择母盘
10 选择子盘
11 选择确定克隆
12 克隆时候的情况
13 撤销母盘 选择子盘,再次启动虚拟机:
撤销iso光盘系统在虚拟机上面的挂载
只保留新创建的硬盘系统
启动成功啦,进入操作系统界面:
14 检查CentOS 6.3 各项操作系统的各项服务
[root@localhost Desktop]# /sbin/service --status-all
abrtd (pid 1835) is running...
abrt-dump-oops (pid 1843) is running...
acpid (pid 1645) is running...
atd (pid 1862) is running...
auditd (pid 1520) is running...
avahi-daemon (pid 1609) is running...
Usage: /etc/init.d/bluetooth {start|stop}
cpuspeed is stopped
crond (pid 1851) is running...
cupsd (pid 1620) is running...
dnsmasq is stopped
firstboot is not scheduled to run
hald (pid 1654) is running...
httpd is stopped
ip6tables: Firewall is not running.
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:80
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
irqbalance is stopped
Kdump is not operational
lvmetad is stopped
mdmonitor is stopped
messagebus (pid 1598) is running...
mysqld is stopped
netconsole module not loaded
Configured devices:
lo
Currently active devices:
NetworkManager is stopped
ntpd is stopped
portreserve is stopped
master dead but pid file exists
Process accounting is disabled.
quota_nld is stopped
rdisc is stopped
rngd is stopped
rsyslogd (pid 1545) is running...
sandbox is stopped
saslauthd is stopped
smartd is stopped
snmpd is stopped
snmptrapd is stopped
spice-vdagentd is stopped
openssh-daemon (pid 1753) is running...
vmtoolsd is running
Thinprint daemon is running.
wdaemon is stopped
wpa_supplicant is stopped
备份策略 二
tar命令备份
=================================================
概述:备份关键系统文档
备份工具:linux tar 命令
还原工具:系统安装盘的救援模式
参考资料:
系统救援方面资料
http://redking.blog.51cto.com/27212/119409 --谢谢redking 仁兄
备份策略方面资料
http://vbird.dic.ksu.edu.tw/linux_basic/0580backup.php --谢谢鸟叔 的linux私房菜
操作步骤方面
http://bbs.51cto.com/thread-863113-1.html -- 谢谢450120127 楼主
=================================================
1 需要备份的文档
2 建立文件夹用于存放备份文件
#mkdir /home/root/backup
逐个备份文件
#tar -cvzpf /home/root/backup/boot.tar.gz /boot/*
#tar -cvzpf /home/root/backup/home.tar.gz /home/*
#tar -cvzpf /home/root/backup/var_spool_mail.tar.gz /var/spool/mail/*
#tar -cvzpf /home/root/backup/etc.tar.gz /etc/*
#tar -cvzpf /home/root/backup/root.tar.gz /root/*
#tar -cvzpf /home/root/backup/var_lib_mysql.tar.gz /var/lib/mysql/*
#tar -cvzpf /home/root/backup/usr_share_mysql.tar.gz /usr/share/mysql/*
#tar -cvzpf /home/root/backup/usr_dev.tar.gz /usr/dev/*
备份完成后如下
1 [root@localhost backup]# ll 2 total 87820 3 -rw-r--r-- 1 root root 19537525 Nov 10 13:32 boot.tar.gz 4 -rw-r--r-- 1 root root 8549509 Nov 10 13:40 etc.tar.gz 5 -rw-r--r-- 1 root root 20930866 Nov 10 13:40 home.tar.gz 6 -rw-r--r-- 1 root root 12302 Nov 10 13:40 root.tar.gz 7 -rw-r--r-- 1 root root 39792166 Nov 10 13:41 usr_dev.tar.gz 8 -rw-r--r-- 1 root root 629652 Nov 10 13:40 usr_share_mysql.tar.gz 9 -rw-r--r-- 1 root root 454617 Nov 10 13:40 var_lib_mysql.tar.gz 10 -rw-r--r-- 1 root root 7967 Nov 10 13:35 var_spool_mail.tar.gz
3 实验
删除root文件夹下所有文件
[root@localhost /]# cd root/ [root@localhost ~]# ll total 92 -rw-------. 1 root root 2667 Oct 30 15:17 anaconda-ks.cfg drwxr-xr-x. 3 root root 4096 Nov 10 00:44 Desktop drwxr-xr-x. 2 root root 4096 Oct 30 07:33 Documents drwxr-xr-x. 2 root root 4096 Oct 30 07:33 Downloads -rw-r--r--. 1 root root 38888 Oct 30 15:17 install.log -rw-r--r--. 1 root root 9272 Oct 30 15:16 install.log.syslog drwxr-xr-x. 2 root root 4096 Oct 30 07:33 Music drwxr-xr-x. 2 root root 4096 Oct 30 07:33 Pictures drwxr-xr-x. 2 root root 4096 Oct 30 07:33 Public drwxr-xr-x. 2 root root 4096 Nov 10 04:07 Templates drwxr-xr-x. 2 root root 4096 Oct 30 07:33 Videos [root@localhost ~]# rm -rf *
重新启动虚拟机
采用救援模式启动
选择英语
美式键盘
local DVD
不带网络模式启动
继续
提示
选择第一项
输入命令
果然/root 下面空了
tar命令恢复 /root 文件内容
连续输入两次exit命令 退出救援模式
重启虚拟机
启动成功